MethodChannelAwesomeNotifications class

An implementation of AwesomeNotificationsPlatform that uses method channels.

Inheritance

Properties

actionHandler ActionHandler?
getter/setter pair
createdHandler NotificationHandler?
getter/setter pair
dismissedHandler ActionHandler?
getter/setter pair
displayedHandler NotificationHandler?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
methodChannel MethodChannel
The method channel used to interact with the native platform.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag String
final

Methods

cancel(int id) Future<void>
Cancels a single notification and its respective schedule.
override
cancelAll() Future<void>
Cancels all active notifications and schedules.
override
cancelAllSchedules() Future<void>
Cancels all active schedules, without dismissing the respective notifications.
override
cancelNotificationsByChannelKey(String channelKey) Future<void>
Cancels all active notifications and schedules with the specified channelKey.
override
cancelNotificationsByGroupKey(String groupKey) Future<void>
Cancels all active notifications and schedules with the specified groupKey.
override
cancelSchedule(int id) Future<void>
Cancels a single scheduled notification, without dismissing the active notification.
override
cancelSchedulesByChannelKey(String channelKey) Future<void>
Cancels all active schedules with the specified channelKey, without dismissing the respective notifications.
override
cancelSchedulesByGroupKey(String groupKey) Future<void>
Cancels all active schedules with the specified groupKey, without dismissing the respective notifications.
override
checkPermissionList({String? channelKey, List<NotificationPermission> permissions = const [NotificationPermission.Badge, NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Vibration, NotificationPermission.Light]}) Future<List<NotificationPermission>>
Checks which notification permissions have been granted to the app.
override
createNotification({required NotificationContent content, NotificationSchedule? schedule, List<NotificationActionButton>? actionButtons, Map<String, NotificationLocalization>? localizations}) Future<bool>
LOCAL NOTIFICATION METHODS ********************************************* Creates a new notification with the specified content.
override
createNotificationFromJsonData(Map<String, dynamic> mapData) Future<bool>
Creates a new notification based on a map that is similar to the map produced by the toMap() method of a NotificationModel object.
override
decrementGlobalBadgeCounter() Future<int>
Decrements the global badge counter by 1.
override
dismiss(int id) Future<void>
Dismisses a single notification without canceling its respective schedule.
override
dismissAllNotifications() Future<void>
Dismisses all active notifications without cancelling their respective schedules. Note that dismissing a notification does not remove it from the notification history.
override
dismissNotificationsByChannelKey(String channelKey) Future<void>
Dismisses all active notifications with the specified channelKey, without cancelling their respective schedules.
override
dismissNotificationsByGroupKey(String groupKey) Future<void>
Dismisses all active notifications with the specified groupKey, without cancelling their respective schedules.
override
dispose() → dynamic
DISPOSE METHODS *********************************************
override
getAllActiveNotificationIdsOnStatusBar() Future<List<int>>
override
getAppLifeCycle() Future<NotificationLifeCycle>
Returns the current state of the app lifecycle in regards to notifications.
override
getDrawableData(String drawablePath) Future<Uint8List?>
NATIVE MEDIA METHODS ********************************************* Decodes a native drawable resource into a Uint8List that can be used by Flutter widgets.
override
getGlobalBadgeCounter() Future<int>
Gets the global badge counter, which represents the number of unread notifications that are currently pending for the app.
override
getInitialNotificationAction({bool removeFromActionEvents = false}) Future<ReceivedAction?>
Gets the notification action that launched the app, if any.
override
getLocalization() Future<String>
Gets the current localization code used by the plugin for notification content.
override
getLocalTimeZoneIdentifier() Future<String>
Returns the identifier for the device's local time zone.
override
getNextDate(NotificationSchedule schedule, {DateTime? fixedDate}) Future<DateTime?>
Gets the next valid date for a notification schedule. The schedule parameter is a valid NotificationSchedule model that specifies the notification schedule. The optional fixedDate parameter is a DateTime value that represents the reference date to simulate a schedule in a different time. If this parameter is omitted, the reference date will be set to the current date and time.
override
getUtcTimeZoneIdentifier() Future<String>
Returns the identifier for the UTC time zone.
override
handleMethod(MethodCall call) Future
incrementGlobalBadgeCounter() Future<int>
Increments the badge counter by 1 and returns the new value. If there is no current value for the badge counter, it will be set to 1. This method is the most performant way to increment the badge counter by a single unit.
override
initialize(String? defaultIcon, List<NotificationChannel> channels, {List<NotificationChannelGroup>? channelGroups, bool debug = false, String? languageCode}) Future<bool>
Initializes the plugin by creating a default icon and setting up the initial notification channels. This method only needs to be called once in the main.dart file of your application.
override
isNotificationActiveOnStatusBar({required int id}) Future<bool>
Checks whether a notification with the specified ID is currently active on the device's status bar.
override
isNotificationAllowed() Future<bool>
Checks whether notifications are currently allowed globally on the device.
override
listScheduledNotifications() Future<List<NotificationModel>>
Lists all active scheduled notifications.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeChannel(String channelKey) Future<bool>
Removes a notification channel with the specified channelKey.
override
requestPermissionToSendNotifications({String? channelKey, List<NotificationPermission> permissions = const [NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Badge, NotificationPermission.Vibration, NotificationPermission.Light]}) Future<bool>
Requests permission from the user to send notifications from the app.
override
resetGlobalBadge() Future<void>
Resets the global badge counter to zero. This removes any badge icon from the app icon in the launcher. Note that resetting the badge counter does not cancel any scheduled or active notifications.
override
setChannel(NotificationChannel notificationChannel, {bool forceUpdate = false}) Future<void>
Sets a new notification channel or updates an existing channel.
override
setGlobalBadgeCounter(int? amount) Future<void>
Sets the global badge counter to the specified value. This value will be displayed on the app's icon badge (if supported by the device). If the amount is 0, the badge counter will be cleared.
override
setListeners({required ActionHandler onActionReceivedMethod, NotificationHandler? onNotificationCreatedMethod, NotificationHandler? onNotificationDisplayedMethod, ActionHandler? onDismissActionReceivedMethod}) Future<bool>
Defines the global or static methods that will receive notification events. Only after set at least one method, the notification's events will be delivered. These methods require to use the notation @pragma("vm:entry-point")
override
setLocalization({required String? languageCode}) Future<bool>
The setLocalization method is used to set the desired localization for notifications. It takes a required languageCode parameter, which is an optional, case-insensitive String that represents the language code for the desired localization (e.g. "en" for English, "pt-br" for Brazilian Portuguese, "es" for Spanish, etc.). If the languageCode parameter is null or not provided, the default localization will be loaded from the device system.
override
shouldShowRationaleToRequest({String? channelKey, List<NotificationPermission> permissions = const [NotificationPermission.Badge, NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Vibration, NotificationPermission.Light]}) Future<List<NotificationPermission>>
Checks whether the app should show a rationale to the user before requesting notification permissions.
override
showAlarmPage() Future<void>
Opens the system's notifications settings page for the app's alarms.
override
showGlobalDndOverridePage() Future<void>
Opens the system settings page for overriding device Do Not Disturb mode.
override
showNotificationConfigPage({String? channelKey}) Future<void>
Opens the notification configuration page for the app.
override
toString() String
A string representation of this object.
inherited
validateId(int id) → void

Operators

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