NotificationManager class
Manager class for handling notification lifecycle and operations
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastTokenError → String?
-
The reason the last FCM token fetch returned null, or null if it succeeded.
Useful for surfacing actionable diagnostic messages in the UI.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelAllScheduledNotifications(
) → Future< bool> - Cancels all scheduled notifications
-
cancelScheduledNotification(
int id) → Future< bool> - Cancels a scheduled notification
-
clearBadgeCount(
) → Future< void> - Clears badge count
-
clearInAppTemplates(
) → void - Clears registered in-app templates
-
clearPendingInAppMessages(
{String? id}) → Future< void> - Clears pending in-app messages
-
clearToken(
) → Future< void> - Clears FCM token
-
createCustomSoundChannel(
{required String channelId, required String channelName, required String channelDescription, required String soundFileName, NotificationImportanceEnum importance = NotificationImportanceEnum.high, NotificationPriorityEnum priority = NotificationPriorityEnum.high, bool enableVibration = true, bool enableLights = true}) → Future< void> - Creates a custom notification channel with sound (Android)
-
createNotificationGroup(
{required String groupKey, required String groupTitle, required List< NotificationData> notifications, String? channelId}) → Future<void> - Creates a notification group with multiple notifications
-
dismissNotificationGroup(
String groupKey) → Future< void> - Dismisses a notification group (Android)
-
dispose(
) → Future< void> - Disposes of resources
-
emitTestClick(
NotificationData data) → void - Exposes a way for tests to emit synthetic click events.
-
enableDefaultDataOnlyBridge(
{String? channelId, String titleKey = 'title', String bodyKey = 'body'}) → void -
flushPendingInAppMessages(
) → Future< void> - Flushes any stored in-app messages so the host app can present them now
-
getAndroidBadgeCount(
) → Future< int?> - Gets Android badge count
-
getAvailableSounds(
) → Future< List< String> ?> - Gets available system notification sounds (iOS)
-
getFcmToken(
) → Future< String?> - Gets FCM token
-
getInAppMessageStream(
{bool includePendingStorageItems = true}) → Stream< InAppNotificationData> - Provides stream of in-app messages triggered by data-only pushes
-
getInitialNotificationData(
) → Future< NotificationData?> - Gets the initial notification data (instance wrapper)
-
getIOSBadgeCount(
) → Future< int?> - Gets iOS badge count
-
getNotificationClickStream(
) → Stream< NotificationData?> - Gets the notification click stream
-
getPendingNotifications(
) → Future< List?> - Gets pending notifications
-
handleBackgroundMessage(
RemoteMessage message) → Future< void> - Internal handler to leverage plugin services during background delivery.
-
initialize(
{required String senderId, required List< NotificationChannelData> androidChannels, required String androidNotificationIconPath, Future<bool> updateTokenCallback(String fcmToken)?, bool includeInitialNotificationInStream = true}) → Future<Stream< NotificationData?> ?> - Initializes the notification manager
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processNotification(
RemoteMessage message, {bool isFromTerminated = false, bool emitToClickStream = true}) → Future< void> - Processes a notification
-
registerInAppTemplates(
Map< String, InAppNotificationTemplate> templates) → void - Registers in-app notification templates
-
runDiagnostics(
) → Future< NotificationDiagnosticsResult> - Runs a best-effort diagnostics sweep and returns actionable hints.
-
scheduleNotification(
{required int id, required String title, required String body, required DateTime scheduledDate, String? channelId, Map< String, dynamic> ? payload, List<NotificationAction> ? actions, bool allowWhileIdle = false}) → Future<bool> - Schedules a notification
-
scheduleRecurringNotification(
{required int id, required String title, required String body, required RepeatIntervalEnum repeatInterval, required int hour, required int minute, String? channelId, Map< String, dynamic> ? payload, List<NotificationAction> ? actions}) → Future<void> - Schedules a recurring notification
-
setAnalyticsCallback(
void callback(String event, Map< String, dynamic> data)) → void - Sets analytics callback
-
setAndroidBadgeCount(
int count) → Future< void> - Sets badge count for Android
-
setBackgroundMessageHandler(
Future< void> handler(RemoteMessage message)) → Future<void> - Registers a background message handler. The handler must be a top-level or static function as required by Firebase Messaging.
-
setBackgroundProcessingCallback(
BackgroundMessageCallback? callback) → Future< void> -
setDataOnlyMessageBridge(
DataOnlyMessageBridge? bridge) → void -
setForegroundNotificationOptions(
ForegroundNotificationOptions options) → void - Updates default foreground notification presentation options.
-
setInAppDeliveryPolicy(
InAppDeliveryPolicy policy) → Future< void> -
setInAppFallbackDisplayHandler(
InAppNotificationDisplayCallback? fallback) → void - Sets fallback display handler for unregistered templates
- Sets the navigator key used for in-app template presentation.
-
setIOSBadgeCount(
int count) → Future< void> - Sets badge count for iOS
-
setUnifiedMessageHandler(
UnifiedMessageHandler? handler) → Future< void> -
showGroupedNotification(
{required String title, required String body, required String groupKey, required String groupTitle, String? channelId, Map< String, dynamic> ? payload, bool isSummary = false, int? notificationId}) → Future<void> - Shows a grouped notification (Android)
-
showNotificationWithActions(
{required String title, required String body, required List< NotificationAction> actions, Map<String, dynamic> ? payload, String? channelId, int? notificationId}) → Future<void> - Shows a notification with actions
-
showThreadedNotification(
{required String title, required String body, required String threadIdentifier, String? channelId, Map< String, dynamic> ? payload, int? notificationId}) → Future<void> - Shows a threaded notification (iOS conversation threads)
-
subscribeToTopic(
String topic) → Future< void> - Subscribes to a topic
-
toString(
) → String -
A string representation of this object.
inherited
-
trackAnalyticsEvent(
String event, Map< String, dynamic> data) → void - Tracks analytics event
-
unsubscribeFromAllTopics(
) → Future< void> - Unsubscribes from all topics
-
unsubscribeFromTopic(
String topic) → Future< void> - Unsubscribes from a topic
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → NotificationManager
-
Singleton instance
no setter
Static Methods
-
getInitialNotificationDataStatic(
) → Future< NotificationData?> - Gets the initial notification data (static, safe to call early)