Created
July 7, 2019 09:58
-
-
Save nikli2009/4155e0a5dc52f394e695a48b6a48072d to your computer and use it in GitHub Desktop.
Dart Enum
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
void main() { | |
var orderType = OrderType.Domestic; | |
// ENUM item -> index | |
print(' '.padLeft(10,'-') + 'Enum index' + ' '.padRight(10,'-')); | |
print(orderType.index); | |
// ENUM item -> value | |
print(' '.padLeft(10,'-') + 'Enum value' + ' '.padRight(10,'-')); | |
print(orderType); | |
} | |
enum OrderType { | |
International, | |
Domestic, | |
Other | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment