Last active
October 12, 2024 08:18
-
-
Save gyugyu90/8f7faaca34aa1152c992b896f5d8a06a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Coffee { | |
String beanType; | |
int waterAmount; | |
bool hot; | |
Syrup? syrup; | |
Coffee(this.beanType, [this.waterAmount = 40, this.hot = true, this.syrup]); | |
Coffee.iceAmericano(this.beanType, this.waterAmount, [this.syrup]) | |
: hot = false; | |
Coffee.sweetIceAmericano(String beanType) | |
: this(beanType, 200, false, Syrup('Sugar', 5)); // redirect | |
bool isEspresso() { | |
return waterAmount <= 50; | |
} | |
} | |
void main() { | |
var coffee = Coffee.sweetIceAmericano('콜롬비아 수프리모'); | |
print(coffee.syrup?.amount); // 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment