Skip to content

Instantly share code, notes, and snippets.

@OnlyTarg
Last active December 13, 2021 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OnlyTarg/4d385aa60850e41f05cac06f12bb1437 to your computer and use it in GitHub Desktop.
Save OnlyTarg/4d385aa60850e41f05cac06f12bb1437 to your computer and use it in GitHub Desktop.
enum MyEnum { one, two, three }
void main() {
print(MyEnum.one);
print(MyEnum.one.name); // one
final map = MyEnum.values.asNameMap();
print(map);
print(MyEnum.values.byName('two'));
//print(MyEnum.values.byName('two1'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment