Page 30 - Dart Language
P. 30
Chapter 10: Enums
Examples
Basic usage
enum Fruit {
apple, banana
}
main() {
var a = Fruit.apple;
switch (a) {
case Fruit.apple:
print('it is an apple');
break;
}
// get all the values of the enums
for (List<Fruit> value in Fruit.values) {
print(value);
}
// get the second value
print(Fruit.values[1]);
}
Read Enums online: https://riptutorial.com/dart/topic/5107/enums
https://riptutorial.com/ 25

