AOSSIE-Org / AOSSIE-Org/NeuroTrack

fix: Don't use BuildContext across async gaps (use_build_context_synchronously)

オープン
#197 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Dart
スター
29
フォーク
50
PR マージ指標
30日以内にマージされた PR はありません

説明

## Summary

`flutter analyze` flags **4 locations** across both apps where a `BuildContext` is used after an `await` without a proper `mounted` guard. This can cause crashes if the widget is unmounted between the async call and the context usage.

## Affected Files

### patient app
| File | Line | Detail |
|------|------|--------|
| `lib/presentation/result/book_appointment.dart` | 55 | `use_build_context_synchronously` |
| `lib/provider/therapist_provider.dart` | 65, 69 | `use_build_context_synchronously` |

### therapist app
| File | Line | Detail |
|------|------|--------|
| `lib/presentation/auth/personal_details_screen.dart` | 115, 124 | `use_build_context_synchronously` — guarded by an **unrelated** `mounted` check |

## Steps to Reproduce

```
cd patient && flutter analyze
cd ../therapist && flutter analyze
```

## Expected Behavior

All context usages after `await` are guarded by `if (!mounted) return` or the context reference is captured before the async gap.

## Fix

- Add `if (!mounted) return;` immediately after each `await` before accessing `context`
- In `personal_details_screen.dart`: move the `mounted` check to guard the specific context access (not an unrelated branch)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。