Last active
August 15, 2020 22:56
-
-
Save attilavago/4fb72b9c0fec5d79baddf9f2f0c3f6fb to your computer and use it in GitHub Desktop.
A Dart enum example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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