Skip to content

Instantly share code, notes, and snippets.

@mono0926
Created August 31, 2023 05:05
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 mono0926/0952fc69a03b638665da268b31659f8b to your computer and use it in GitHub Desktop.
Save mono0926/0952fc69a03b638665da268b31659f8b to your computer and use it in GitHub Desktop.
void main() {
print(Animal.dog.name); // 'dog'
print(Animal2.dog.name); // '🐶'
// Animal2 から 元々のnameのdog・cat文字列を得たい🤔
}
enum Animal {
dog,
cat,
}
enum Animal2 {
dog('🐶'),
cat('🐱'),
;
const Animal2(this.name);
final String name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment