p238049y / paractice

チュートリアル用のリポジトリ
1 stars 0 forks source link

[タスク] 中級編1:非同期処理 #5

Open p238049y opened 2 years ago

p238049y commented 2 years ago

https://zenn.dev/kazutxt/books/flutter_practice_introduction/viewer/intermediate_async をやってみよう

p238049y commented 2 years ago

async awaitの実装は面白い 本当に一個一個処理するんやな〜

class Async {
  void asynctest2() async {
    print("method begin");
    print(DateTime.now().toString());
    print("data1 start");
    print(await asyncFunc("data1", 3));
    print("data2 start");
    print(await asyncFunc("data2", 2));
    print("data3 start");
    print(await asyncFunc("data3", 1));
  }
flutter: 2022-03-07 22:43:28.725179
flutter: data1 start
flutter: data1:2022-03-07 22:43:31.732364
flutter: data2 start
flutter: data2:2022-03-07 22:43:33.738063
flutter: data3 start
flutter: data3:2022-03-07 22:43:34.743142