Open feinstein opened 5 years ago
To that extent, it might be nice to add an index to the EnumClass, as Dart enums have by default (aka the ordinal in Java): https://dart.dev/guides/language/language-tour#enumerated-types
Sorry for lack of response. Thanks for filing. Will likely look at this whenever I next take a long, hard look at enums :) not sure when that will be though.
+1 for this. Enums in most (all?) other implementations are ordered and can reliably be mapped to integers and back.
Currently EnumClass holds its values in a
BuiltSet
, but although we can convert it to a list usingtoList()
,enum.values
are lists and this would reflect better the Dart API.Using lists is useful when we want the index of a enum value.