Skip to content

Instantly share code, notes, and snippets.

@doyle-flutter
Created August 25, 2021 14:29
Show Gist options
  • Save doyle-flutter/601433ec7c5fa02e4e5b13984a43dccb to your computer and use it in GitHub Desktop.
Save doyle-flutter/601433ec7c5fa02e4e5b13984a43dccb to your computer and use it in GitHub Desktop.
Dart 로 부대찌개 끓이기 01
void main() {
BudaeJjigae(
water: FoodIngredient(productName: "넝심 사골", gramme: "300g"),
ham: FoodIngredient(productName: "스팸 오리지널", gramme: "100g"),
sausage: FoodIngredient(productName: "맛조은 후랑크소세지", gramme: "10g"),
spices: [
FoodIngredient(productName: "고운 소금", gramme: "10g"),
FoodIngredient(productName: "고운 고춧가루", gramme: "20g"),
FoodIngredient(productName: "달 밝은 고추장", gramme: "30g"),
FoodIngredient(productName: "백설탕", gramme: "10g"),
FoodIngredient(productName: "진한 국간장", gramme: "10g"),
FoodIngredient(productName: "국산 간마늘", gramme: "50g"),
],
vegetables: [
FoodIngredient(productName: "국산 생양파", gramme: "40g"),
FoodIngredient(productName: "익은 김치", gramme: "30g"),
]
);
}
class FoodIngredient{
final String productName;
final String gramme;
const FoodIngredient({required this.productName,required this.gramme});
}
class BudaeJjigae{
bool isCooking = false;
final FoodIngredient water;
final FoodIngredient ham;
final FoodIngredient sausage;
final List<FoodIngredient> spices;
final List<FoodIngredient> vegetables;
BudaeJjigae({
required this.water,
required this.ham,
required this.sausage,
required this.spices,
required this.vegetables,
}){
Future.microtask(_cooking);
}
Future<void> _cooking() async{
print("🧑‍🍳");
print("부대찌개 요리를 시작합니다 !");
print("🔪${this.ham.productName}과 ${this.sausage.productName}를 자릅니다.");
await Future.delayed(Duration(seconds: 1), () => print("🔪🔪"));
await Future.delayed(Duration(seconds: 1), () => print("🔪🔪🔪"));
String sliceVegetable = this.vegetables.map<String>((FoodIngredient fi) => fi.productName).toList().join(',');
print("🔪${sliceVegetable}들을 자릅니다.");
await Future.delayed(Duration(seconds: 1), () => print("🔪🔪"));
await Future.delayed(Duration(seconds: 1), () => print("🔪🔪🔪"));
print("🍲${this.water.productName} ${this.water.gramme}을 냄비에 넣고 센 불로 3초 동안 끓입니다.");
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥🔥🔥"));
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥🔥🔥"));
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥🔥🔥"));
String spicess = this.spices.map<String>((FoodIngredient fi) => (fi.productName+"(${fi.gramme})")).toList().join(',');
print("🍲${this.water.productName}이 끓기 시작하여 양념 및 재료들을 모두 넣어줍니다.");
print("* 양념 및 재료 : $spicess");
print("👉5초간 중불로 더 끓입니다.");
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥"));
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥"));
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥"));
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥"));
await Future.delayed(Duration(seconds: 1), () => print("🔥🔥🔥"));
print("그릇에 옯겨 담아 줍니다.");
await Future.delayed(Duration(seconds: 1), () => print("👉🍲"));
this.isCooking = true;
print("🤩 '부대찌개' 가 완성되었습니다!");
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment