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 Headphone { | |
double volume = 5; | |
void increaseVolume() { | |
if (volume == 10) { | |
print('최고 볼륨입니다!'); | |
return; | |
} | |
volume++; |
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
abstract class Language { | |
factory Language(String languageCode) { | |
if (languageCode == 'ko') { | |
return Korean(); | |
} | |
return English(); | |
} | |
void sayHello(); |
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 Logger { | |
static final Logger _instance = Logger._internal('MyApplication'); | |
String prefix; | |
Logger._internal(this.prefix); | |
factory Logger() { | |
return _instance; | |
} |
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; |
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 |
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 Tea { | |
final String teaBag; | |
Milk? milk; | |
late String allergyInfo; | |
Tea(this.teaBag, [this.milk]); | |
} | |
class Milk { | |
String name = "서울우유"; |
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 Tea { | |
final String teaBag; | |
Milk? milk; | |
Tea(this.teaBag, [this.milk]); | |
String getFullName() { | |
if (milk != null) { | |
return "$teaBag 밀크티"; | |
} |
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 Tea { | |
String teaBag = "얼그레이"; | |
Milk? milk; | |
String getFullName() { | |
if (milk != null) { | |
return "$teaBag 밀크티"; | |
} | |
return "$teaBag 티"; |
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 Syrup { | |
String name; | |
int amount; | |
Syrup(this.name, this.amount); | |
} | |
class Coffee { | |
String beanType; | |
int waterAmount; |
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 Syrup { | |
String name; | |
int amount; | |
Syrup(this.name, this.amount); | |
} | |
class Coffee { | |
String beanType; | |
int waterAmount; |