flutter_notification_wrapper library

A Flutter package providing a unified interface over Firebase Cloud Messaging and AwesomeNotifications: background handling, action buttons, scheduling, grouping, badges and channel configuration.

Example:

final handler = await DefaultNotificationHandler.initializeSharedInstance(
  config: NotificationConfig(
    channelKey: 'app_notifications',
    channelName: 'App Notifications',
    channelDescription: 'General app notifications',
  ),
);

await handler.showRegularNotification(
  title: 'Hello',
  body: 'This is a test notification',
);

The optional utilities (Logger, Rx, Debouncer) are intentionally NOT exported here to avoid polluting the consumer namespace. Import them explicitly if you want them:

import 'package:flutter_notification_wrapper/utils.dart';

Classes

DefaultNotificationHandler
Default NotificationWrapper implementation backed by AwesomeNotifications for display and Firebase Cloud Messaging for delivery.
FirebaseOptions
The options used to configure a Firebase app.
NotificationActionButton
Represents a button to be displayed inside a notification. Note: Since Android 7, icons are only displayed for Media Layout Notifications. The icon must be a native resource media type.
NotificationCalendar
Represents a notification scheduling configuration based on calendar components.
NotificationConfig
Configuration class for notification channels and appearance.
NotificationContent
Represents the content of a notification with customizable options. If notification has no body or title, it will only be created, but not displayed to the user (background notification).
NotificationWrapper
Abstract contract for a unified Firebase Cloud Messaging + AwesomeNotifications handler.
ReceivedAction
All received details of a user action over a Notification
ReceivedNotification
All received details of a notification created or displayed on the system The data field
RemoteMessage
A class representing a message sent from Firebase Cloud Messaging.

Enums

ActionType
Defines the notification button's type ActionType.Default Is the default action type, forcing the app to goes foreground. ActionType.SilentAction Do not forces the app to go foreground, but runs on main thread, accept visual elements and can be interrupt if main app gets terminated. ActionType.SilentBackgroundAction Do not forces the app to go foreground and runs on background, not accepting any visual elements. The execution is done on background thread. ActionType.KeepOnTop Fires the respective action without close the notification status bar and don't bring the app to foreground. ActionType.DisabledAction When pressed, the notification just close itself on the tray, without fires any action event. ActionType.DismissAction Behaves as the same way as a user dismissing action, dismissing the respective notification and firing the dismissMethod. Ignores autoDismissible property. ActionType.InputField (Deprecated) When the button is pressed, it opens a dialog shortcut to send an text response.
AuthorizationStatus
Represents the current status of the platforms notification permissions.
GroupAlertBehavior
Sets the group alert behavior for this notification. Use this method to mute this notification if alerts for this notification's group should be handled by a different notification. This is only applicable for notifications that belong to a group. GroupAlertBehavior.All All notifications in a group with sound or vibration ought to make sound or vibrate (respectively), so this notification will not be muted when it is in a group. GroupAlertBehavior.Summary All children notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate. GroupAlertBehavior.Children The summary notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate
NotificationCategory
One of the predefined notification categories that best describes this Notification. May be used by the system for ranking and filtering.
NotificationImportance
Determines the importance to show immeadetly the notification to the user Default: shows everywhere, makes noise, but does not visually intrude. Higher: shows everywhere, makes noise and peeks. May use full screen intents. Low: Shows in the shade, and potentially in the status bar (see shouldHideSilentStatusBarIcons()), but is not audibly intrusive. Min: only shows in the shade, below the fold. This should not be used with Service#startForeground(int, Notification) since a foreground service is supposed to be something the user cares about so it does not make semantic sense to mark its notification as minimum importance. If you do this as of Android version Build.VERSION_CODES.O, the system will show a higher-priority notification about your app running in the background. None: A notification with no importance: does not show in the shade.
NotificationLayout
Notification Layout to be used as reference to build the notification. If is not possible to build the desired layout, use the default one.
NotificationPrivacy
Hides sensitive notifications when the device is on lock screen Public: Show this notification in its entirety on all lockscreens Private: Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens Secret: Do not reveal any part of this notification on a secure lockscreen

Functions

backgroundMessageHandler(RemoteMessage message) Future<void>