Alarm No-Schedule Fallback Plan
Goal
Ensure /alarmScreen returns to /home when opened while the schedule state is already notExists, instead of showing a loading spinner indefinitely.
Context
- SRD: if no active schedule exists, alarm should fall back through
notExists handling and navigate home.
- Current
AlarmScreen listener only navigates when the previous state was not notExists and the current state becomes notExists.
- If
/alarmScreen is opened while ScheduleBloc.state.status is already notExists, the listener does not fire and the builder shows the loading scaffold.
- This can happen after a stale notification, deleted schedule, or already-ended schedule.
Decisions
- Treat an already-
notExists state on alarm entry as terminal for the alarm route.
- Navigate home after build, not synchronously inside build.
- Preserve finish-result navigation when
_navigateAfterFinish is pending.
Steps
- Add a post-frame fallback in
AlarmScreen when current state is notExists and no finish navigation is pending.
- Keep the existing listener for transitions into
notExists.
- Add a widget test that pumps
/alarmScreen with initial ScheduleState.notExists() and expects navigation to /home.
- Add a stale-notification-style test where subscription emits
null while already notExists.
Validation
- Run
flutter test test/presentation/alarm/screens/preparation_flow_widget_test.dart.
- Confirm finish flow still navigates to
/earlyLate when pending finish data exists.
Open Questions
Alarm No-Schedule Fallback Plan
Goal
Ensure
/alarmScreenreturns to/homewhen opened while the schedule state is alreadynotExists, instead of showing a loading spinner indefinitely.Context
notExistshandling and navigate home.AlarmScreenlistener only navigates when the previous state was notnotExistsand the current state becomesnotExists./alarmScreenis opened whileScheduleBloc.state.statusis alreadynotExists, the listener does not fire and the builder shows the loading scaffold.Decisions
notExistsstate on alarm entry as terminal for the alarm route._navigateAfterFinishis pending.Steps
AlarmScreenwhen current state isnotExistsand no finish navigation is pending.notExists./alarmScreenwith initialScheduleState.notExists()and expects navigation to/home.nullwhile alreadynotExists.Validation
flutter test test/presentation/alarm/screens/preparation_flow_widget_test.dart./earlyLatewhen pending finish data exists.Open Questions