NotificationRepository class

The repository responsible for the full lifecycle of push and local notifications.

Handles:

  • Requesting notification permissions (iOS + Android 13+)
  • Initialising FlutterLocalNotificationsPlugin for foreground display
  • Registering FCM listeners (foreground, background, app-open)
  • Showing a local notification when an FCM message arrives in the foreground

Lifecycle is driven by AuthenticationBloc:

Constructors

NotificationRepository({required AppLogger logger})
Creates a NotificationRepository that reports lifecycle events and errors via logger.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAllPushNotifications() Future<void>
Clears all notifications from the device's OS notification tray.
dispose() Future<void>
Cancels FCM listeners, invalidates the FCM token, and resets state so initNotifications can run again on the next login.
initNotifications() Future<void>
Initialises the notification system. Safe to call multiple times — subsequent calls after the first are no-ops until dispose is called.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openNotificationSettings() Future<void>
Opens the device's notification settings page.
requestPermission() Future<PermissionStatus>
Requests notification permission outside of the initial login flow.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited