Skip to content

Instantly share code, notes, and snippets.

@nitaking
Last active September 7, 2023 01:07
Show Gist options
  • Save nitaking/5403390056f8ab5b18a31cb4613a11b3 to your computer and use it in GitHub Desktop.
Save nitaking/5403390056f8ab5b18a31cb4613a11b3 to your computer and use it in GitHub Desktop.
enum Animal {
Cat,
Dog,
}
hello(Animal animal) {
return switch (animal) {
Animal.Cat => 'is Cat',
Animal.Dog => 'is Dog',
};
}
sealed class ScreenParams {}
class CreateParams implements ScreenParams {
final String name;
CreateParams({
required this.name,
});
}
class UpdateParams implements ScreenParams {
final String id;
final String? name;
UpdateParams({
required this.id,
this.name,
});
}
void main() {
print(hello(Animal.Cat));
print(hello(Animal.Dog));
}
/// Console
/// is Cat
/// is Dog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment