Skip to content

Session11 #12

Open
Open

Description

@github-actions

スレッドブロック

時間のかかる処理を扱ってみましょう。

課題

  • 使用する API を fetchWeather() から syncFetchWeather() に変更する
  • API の処理が戻るまで CircularProgressIndicator を表示する

動作イメージ

demo

ヒント

Dart の実行モデルはシングルスレッド・イベントループです。

そのため、そのままだと画面が固まってしまい CircularProgressIndicator は表示されません。

よって、このようにスレッドをブロックしてしまうような処理の場合は isolates を使用します。

参考資料

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions