MethodChannelAwesomeNotifications class
An implementation of AwesomeNotificationsPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- AwesomeNotificationsPlatform
- MethodChannelAwesomeNotifications
Constructors
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.
final
- 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
-
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 -
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, List< NotificationActionButton> ? actionButtons, List<NotificationExtension> ? extensions}) → 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(
) → void -
DISPOSE METHODS *********************************************
override
-
getAllActiveNotificationIdsOnStatusBar(
) → Future< List< int> > -
The ids of the app's notifications currently shown in the status bar
(see isNotificationActiveOnStatusBar).
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
-
getLocalTimeZoneIdentifier(
) → Future< String> -
Returns the identifier for the device's local time zone.
override
-
getPermissionStatusList(
{String? channelKey, List< NotificationPermission> permissions = const [NotificationPermission.Badge, NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Vibration, NotificationPermission.Light]}) → Future<Map< NotificationPermission, NotificationPermissionStatus> > -
Returns the explicit status of each requested NotificationPermission.
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}) → 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.dartfile 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
-
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
amountis 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
-
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