Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session11 #12

Open
github-actions bot opened this issue Jun 6, 2023 · 0 comments
Open

Session11 #12

github-actions bot opened this issue Jun 6, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

スレッドブロック

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

課題

  • 使用する 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
Labels
Projects
None yet
Development

No branches or pull requests

0 participants