FcmTokenManager class
Methods related to managing FCM token and notification permissions
getAppNotificationPreference returns enum of current notification settings unless user has not yet given or denied permission - in that case it will ask for permission.
onLogin and onLogout manage app lifecycle events e.g. checking if current token is not stale, updating backend with token information and deleting token from backend when user logs out
setAppNotificationPreference enables user to disable notifications without prohibiting them in device settings by deleting FCM token from backend db
Constructors
- FcmTokenManager.initialize({required FcmAppBackendInterface apiInterface, required Duration tokenTtl})
-
Call this to initialize manager before calling other methods
factory
- FcmTokenManager.instance()
-
Get instance of this object (singleton)
factory
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
-
getAppNotificationPreference(
String userId) → Future< NotificationPermissionStatus> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onLogin(
{required String userId}) → Future< void> -
onLogout(
{required String userId}) → Future< void> -
setAppNotificationPreference(
{required bool isEnabled, required String userId}) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited