Last active
September 7, 2023 01:07
-
-
Save nitaking/5403390056f8ab5b18a31cb4613a11b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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