SuperFCM class
A class that manages push notification handling and device subscription management for the SuperFCM service.
This class follows the singleton pattern and provides methods to:
- Initialize the SDK and register device for push notifications
- Link external user IDs to device subscriptions
- Manage subscription properties
- Track and handle notification delivery statuses
- Track custom events
- Handle notification permissions
Example:
await SuperFCM.instance.initialize(config);
await SuperFCM.instance.linkExternalId('user123');
await SuperFCM.instance.setProperty('userType', 'premium');
Constructors
- SuperFCM.new()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialized ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subscription ↔ Subscription?
-
getter/setter pair
Methods
-
deleteProperties(
List< String> properties) → Future<bool> - Deletes multiple properties from the current subscription.
-
deleteProperty(
String property) → Future< bool> - Deletes a single property from the current subscription.
-
dispose(
) → Future< void> - Cleans up resources used by SuperFCM.
-
flushEvents(
) → Future< bool> - Manually triggers a flush of cached events to the server.
-
initialize(
SuperFCMConfig config, {NotificationCallback? onOpened, NotificationCallback? onForeground, NotificationCallback? onBackground}) → Future< bool> - Initializes the SuperFCM SDK with the provided configuration.
-
linkExternalId(
String externalId) → Future< bool> - Links an external user ID to the current device subscription.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestPermission(
{bool alert = true, bool announcement = false, bool badge = true, bool carPlay = false, bool criticalAlert = false, bool provisional = false, bool sound = true}) → Future< PermissionStatus> - Requests push notification permissions from the user.
-
setOnBackgroundCallback(
NotificationCallback? callback) → void - Sets the callback for background notifications.
-
setOnForegroundCallback(
NotificationCallback? callback) → void - Sets the callback for foreground notifications.
-
setOnOpenedCallback(
NotificationCallback? callback) → void - Sets the callback for notifications that open the app.
-
setProperty(
String key, dynamic value) → Future< bool> - Updates a single subscription property.
-
setSessionCount(
int count) → Future< bool> - Manually sets the session count to a specific value.
-
setTest(
bool value) → Future< bool> - Sets the test flag for the current subscription.
-
toString(
) → String -
A string representation of this object.
inherited
-
trackEvent(
String name) → Future< void> - Logs a custom event with the provided name.
-
updatePermissionStatus(
PermissionStatus status) → Future< bool> - Updates the push notification permission status for the current subscription.
-
updateProperties(
Map< String, dynamic> properties) → Future<bool> - Updates multiple subscription properties simultaneously.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
backgroundHandler(
RemoteMessage message) → Future< void> - Processes messages received while the app is in the background or terminated. This function attempts to make an immediate API request to update delivery status rather than just caching it for later processing.