NotificationMaster class

The main plugin class for NotificationMaster.

Constructors

NotificationMaster()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
onActionTap Stream<Map<String, dynamic>>
Stream of notification action tap events. Each event is a map containing 'route', 'targetScreen', and 'extraData' if available.
no setter
onNotificationTap Stream<Map<String, dynamic>>
Stream of notification tap events. Each event is a map containing 'targetScreen' and 'extraData' if available.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelAllScheduledNotifications() Future<bool>
Cancel every notification scheduled with scheduleNotification.
cancelScheduledNotification(int id) Future<bool>
Cancel a single notification previously scheduled with scheduleNotification.
canScheduleExactAlarms() Future<bool>
Android 12+: whether exact alarms (Alarm Time scheduling) are allowed. Returns true on platforms that do not gate this permission.
checkNotificationPermission() Future<bool>
createCustomChannel({required String channelId, required String channelName, String? channelDescription, NotificationImportance? importance, bool? enableLights, int? lightColor, bool? enableVibration, bool? enableSound}) Future<bool>
getActiveNotificationService() Future<String>
getDeviceToken() Future<String?>
Get the device token for push notifications. Returns the FCM token on Android, APNS token on iOS, or null if unavailable.
getPendingScheduledNotifications() Future<List<int>>
Returns the ids of notifications that are scheduled but not yet delivered.
getPlatformVersion() Future<String?>
getSubscribedTopics() Future<List<String>>
Returns the list of topics this device is currently subscribed to.
isBackgroundPollingRunning() Future<bool>
Whether the background poller daemon is currently running.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openAppNotificationSettings() Future<bool>
Opens the app's notification settings (channels, full-screen intent, etc.). Manual user action only.
openExactAlarmSettings() Future<bool>
Opens the system screen where the user can grant Alarms & reminders. This cannot be granted automatically — the user must toggle it.
requestNotificationPermission() Future<bool>
scheduleNotification({required int id, required String title, required String message, required DateTime scheduledTime, String? channelId, NotificationImportance? importance, bool alarmSound = false, String? targetScreen, Map<String, dynamic>? extraData}) Future<bool>
Schedule a notification to be shown by the operating system at a fixed time, even when the app is fully closed (a real background service).
setFirebaseAsActiveService() Future<bool>
showBigTextNotification({required String title, required String message, required String bigText, String? channelId, NotificationImportance? importance, bool? autoCancel, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
showFullScreenNotification({required String title, required String message, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
Show a full screen notification (most intrusive) Used for high priority alerts like incoming calls
showHeadsUpNotification({required String title, required String message, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
Show a heads-up notification (appears from top with padding) This is the most visible notification type on Android
showImageNotification({required String title, required String message, required String imageUrl, String? channelId, NotificationImportance? importance, bool? autoCancel, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
showNotification({int? id, required String title, required String message, String? channelId, NotificationImportance? importance, bool? autoCancel, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
showNotificationWithActions({required String title, required String message, required List<Map<String, String>> actions, String? channelId, NotificationImportance? importance, bool? autoCancel, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
showStyledNotification({required String title, required String message, String? channelId, String? targetScreen, Map<String, dynamic>? extraData}) Future<int>
Show a styled notification (like in the image with app icon and full text) This displays the notification with the app icon on the left and full message
startBackgroundPollingService({required String pollingUrl, int? intervalMinutes}) Future<bool>
Start a standalone background poller daemon. Supported on Windows, Linux, and macOS. The daemon runs in its own process and keeps polling pollingUrl and showing desktop notifications even after the main Flutter app is fully closed. A log file is written next to the executable for diagnostics.
startForegroundService({required String pollingUrl, int? intervalMinutes, String? channelId, String? channelName, String? channelDescription, NotificationImportance? importance, bool? enableLights, int? lightColor, bool? enableVibration, bool? enableSound}) Future<bool>
startNotificationPolling({required String pollingUrl, int? intervalMinutes}) Future<bool>
stopBackgroundPollingService() Future<bool>
Stop the background poller daemon started via startBackgroundPollingService.
stopForegroundService() Future<bool>
stopNotificationPolling() Future<bool>
subscribeToTopic(String topic) Future<bool>
Subscribe to a notification topic. On Android/iOS with Firebase, this subscribes to an FCM topic.
toString() String
A string representation of this object.
inherited
unsubscribeFromTopic(String topic) Future<bool>
Unsubscribe from a notification topic.

Operators

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