arch-atlas

Notifications Route + FCM Bootstrap

core/routing/app_router.dart · /notifications + main.dart init

di

Overview

GoRoute for /notifications inside the ShellRoute with a custom slide-from-bottom + fade transition. NotificationService.initialize is called from main.dart before runApp so messaging is live for the first frame.

User Flow

  1. main.dart: await NotificationService().initialize() → registers handlers, asks permission, gets initial token.
  2. main.dart wires FirebaseMessaging.onTokenRefresh → DioHelper().syncFcmTokenForAllRoles().
  3. /notifications route in ShellRoute uses CustomTransitionPage with a 400ms slide-and-fade.

Cases & Edge Cases

  • If initialize fails (no Google Play Services on Android, permission denied on iOS), the rest of the app still boots — handlers are no-ops.
  • Top-level background handler must remain top-level (Dart isolate constraint) — don't move it inside the class.

Code References

  • lib/main.dart // Firebase.initializeApp + NotificationService.initialize
  • lib/src/core/routing/app_router.dart:667 // /notifications GoRoute

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

Background handler runs in a separate isolate without your Riverpod tree — it can only log; UI updates must wait for onMessageOpenedApp.