Skip to content

Instantly share code, notes, and snippets.

@attilavago
Last active August 15, 2020 22:56
Show Gist options
  • Save attilavago/4fb72b9c0fec5d79baddf9f2f0c3f6fb to your computer and use it in GitHub Desktop.
Save attilavago/4fb72b9c0fec5d79baddf9f2f0c3f6fb to your computer and use it in GitHub Desktop.
A Dart enum example
enum Status {
none,
running,
stopped,
paused
}
void main() {
print(Status.values);
Status.values.forEach((value) => print('value: $value, index: ${value.index}'));
print('running: ${Status.running}, ${Status.running.index}');
print('running index: ${Status.values[1]}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment