EmailDetailScreen was calling ref.read(emailRepositoryProvider) and
awaiting futures inside initState, tightly coupling the screen to the
repository API. This PR extracts a dedicated EmailDetailNotifier
(AsyncNotifierProvider.autoDispose.family) in di.dart that owns the
load logic and the setFlag(seen: true) side effect. The screen now
watches the provider and renders via detail.when(loading/error/data),
removing all direct repository calls from the widget.
Changes:
lib/di.dart: add emailDetailProvider + EmailDetailNotifier; hide
Drift-generated Email/EmailBody from database.dart to avoid
ambiguous import with the domain model.
lib/ui/screens/email_detail_screen.dart: remove initState override,
remove _dataFuture field, replace FutureBuilder with ref.watch + detail.when, initialize _isFlagged via ref.listen.
Implements A1 from the improvement plan.
`EmailDetailScreen` was calling `ref.read(emailRepositoryProvider)` and
awaiting futures inside `initState`, tightly coupling the screen to the
repository API. This PR extracts a dedicated `EmailDetailNotifier`
(`AsyncNotifierProvider.autoDispose.family`) in `di.dart` that owns the
load logic and the `setFlag(seen: true)` side effect. The screen now
watches the provider and renders via `detail.when(loading/error/data)`,
removing all direct repository calls from the widget.
Changes:
- `lib/di.dart`: add `emailDetailProvider` + `EmailDetailNotifier`; hide
Drift-generated `Email`/`EmailBody` from `database.dart` to avoid
ambiguous import with the domain model.
- `lib/ui/screens/email_detail_screen.dart`: remove `initState` override,
remove `_dataFuture` field, replace `FutureBuilder` with `ref.watch` +
`detail.when`, initialize `_isFlagged` via `ref.listen`.
Closes #19 (A1)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements A1 from the improvement plan.
EmailDetailScreenwas callingref.read(emailRepositoryProvider)andawaiting futures inside
initState, tightly coupling the screen to therepository API. This PR extracts a dedicated
EmailDetailNotifier(
AsyncNotifierProvider.autoDispose.family) indi.dartthat owns theload logic and the
setFlag(seen: true)side effect. The screen nowwatches the provider and renders via
detail.when(loading/error/data),removing all direct repository calls from the widget.
Changes:
lib/di.dart: addemailDetailProvider+EmailDetailNotifier; hideDrift-generated
Email/EmailBodyfromdatabase.dartto avoidambiguous import with the domain model.
lib/ui/screens/email_detail_screen.dart: removeinitStateoverride,remove
_dataFuturefield, replaceFutureBuilderwithref.watch+detail.when, initialize_isFlaggedviaref.listen.Closes #19 (A1)