Last active
October 12, 2024 08:06
-
-
Save gyugyu90/d64f932044eba50675f67766ef38b463 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]); | |
// named constructor | |
Coffee.iceAmericano(this.beanType, this.waterAmount, [this.syrup]) | |
: hot = false; // initializer list | |
bool isEspresso() { | |
return waterAmount <= 50; | |
} | |
} | |
void main() { | |
var coffee = Coffee.iceAmericano('콜롬비아 수프리모', 300); | |
print(coffee.hot); // false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment