Does Dart support enumerations? For instance:
enum myFruitEnum { Apple, Banana }
A cursory search of the docs suggests no.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Beginning 1.8, you can use enums like this:
The old approach before 1.8:
Those static constants within the class are compile time constants, and this class can now be used in, for example,
switchstatements: