MethodChannelLocalNotifications class
An implementation of LocalNotificationsPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- LocalNotificationsPlatform
- MethodChannelLocalNotifications
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> -
Cancel a single notification and its respective schedule
override
-
cancelAll(
) → Future< void> -
Cancel and dismiss all notifications and the active schedules
override
-
cancelAllSchedules(
) → Future< void> -
Cancel all active notification schedules without dismiss the respective notifications
override
-
cancelNotificationsByChannelKey(
String channelKey) → Future< void> -
Cancel and dismiss all notifications and schedules with the same channel key
override
-
cancelNotificationsByGroupKey(
String groupKey) → Future< void> -
Cancel and dismiss all notifications and schedules with the same group key
override
-
cancelSchedule(
int id) → Future< void> -
Cancel a single scheduled notification, without dismiss the active notification
override
-
cancelSchedulesByChannelKey(
String channelKey) → Future< void> -
Cancel all active schedules with the same channel key,
without dismiss the respective notifications on status bar
override
-
cancelSchedulesByGroupKey(
String groupKey) → Future< void> -
Cancel all active schedules with the same group key,
without dismiss the respective notifications on status bar
override
-
checkPermissionList(
{String? channelKey, List< NotificationPermission> permissions = const [NotificationPermission.Badge, NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Vibration, NotificationPermission.Light]}) → Future<List< NotificationPermission> > -
Check each individual permission to send notifications and returns only the allowed permissions
override
-
createNotification(
{required NotificationContent content, NotificationSchedule? schedule, List< NotificationActionButton> ? actionButtons}) → Future<bool> -
LOCAL NOTIFICATION METHODS *********************************************
Creates a new notification.
If notification has no
body
ortitle
, it will only be created, but never displayed. (background notification)schedule
andactionButtons
are optionaloverride -
createNotificationFromJsonData(
Map< String, dynamic> mapData) → Future<bool> -
Creates a new notification based on a map similar to the map produced by
toMap method
override
-
decrementGlobalBadgeCounter(
) → Future< int> -
Decrement the badge counter
override
-
dismiss(
int id) → Future< void> -
Dismiss a single notification, without cancel its schedule
override
-
dismissAllNotifications(
) → Future< void> -
Dismiss all active notifications, without cancel the active respective schedules
override
-
dismissNotificationsByChannelKey(
String channelKey) → Future< void> -
Dismiss all active notifications with the same channel key on status bar,
without cancel the active respective schedules
override
-
dismissNotificationsByGroupKey(
String groupKey) → Future< void> -
Dismiss all active notifications with the same group key on status bar,
without cancel the active respective schedules
override
-
dispose(
) → dynamic -
DISPOSE METHODS *********************************************
override
-
getAppLifeCycle(
) → Future< NotificationLifeCycle> -
Get the current Local time zone identifier
override
-
getDrawableData(
String drawablePath) → Future< Uint8List?> -
NATIVE MEDIA METHODS *********************************************
Decode a native drawable resource into a Uint8List to be used by Flutter widgets
override
-
getGlobalBadgeCounter(
) → Future< int> -
Get badge counter
override
-
getInitialNotificationAction(
{bool removeFromActionEvents = false}) → Future< ReceivedAction?> -
Gets the notification action that launched the app. If the app
wasn't launched by a notification, so it returns null. This method does
not depend on setListeners being called first.
removeFromActionEvents
when set to true, prevents the same action from being delivered in the method onActionMethod, in case it hasn't already happenedoverride -
getLocalTimeZoneIdentifier(
) → Future< String> -
Get the current Local time zone identifier
override
-
getNextDate(
NotificationSchedule schedule, {DateTime? fixedDate}) → Future< DateTime?> -
Get the next valid date for a notification schedule
override
-
getUtcTimeZoneIdentifier(
) → Future< String> -
Get the current UTC time zone identifier
override
-
incrementGlobalBadgeCounter(
) → Future< int> -
Increment the badge counter
override
-
initialize(
String? defaultIcon, List< NotificationChannel> channels, {List<NotificationChannelGroup> ? channelGroups, bool debug = false}) → Future<bool> -
INITIALIZING METHODS *********************************************
Initializes the plugin, creating a default icon and the initial channels. Only needs
to be called at main.dart once.
OBS:
defaultIcon
needs to be a Resource media type OBS 2:channels
are updated if they already existsoverride -
isNotificationAllowed(
) → Future< bool> -
Check if the notifications are globally permitted
override
-
listScheduledNotifications(
) → Future< List< NotificationModel> > -
List all active scheduled notifications.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeChannel(
String channelKey) → Future< bool> -
Remove a notification channel
override
-
requestPermissionToSendNotifications(
{String? channelKey, List< NotificationPermission> permissions = const [NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Badge, NotificationPermission.Vibration, NotificationPermission.Light]}) → Future<bool> -
Prompts the user to enabled notifications
override
-
resetGlobalBadge(
) → Future< void> -
Resets the badge counter
override
-
setChannel(
NotificationChannel notificationChannel, {bool forceUpdate = false}) → Future< void> -
Set a new notification channel or updates if already exists
forceUpdate
: completely updates the channel on Android Oreo and above, but cancels all current notifications.override -
setGlobalBadgeCounter(
int? amount) → Future< void> -
Set the badge counter to any value
override
-
setListeners(
{required ActionHandler onActionReceivedMethod, NotificationHandler? onNotificationCreatedMethod, NotificationHandler? onNotificationDisplayedMethod, ActionHandler? onDismissActionReceivedMethod}) → Future< bool> -
Defines the global or static methods that gonna receive the notification
events. OBS: Only after set at least one method, the notification's events are delivered.
override
-
shouldShowRationaleToRequest(
{String? channelKey, List< NotificationPermission> permissions = const [NotificationPermission.Badge, NotificationPermission.Alert, NotificationPermission.Sound, NotificationPermission.Vibration, NotificationPermission.Light]}) → Future<List< NotificationPermission> > -
Check if the app must show some rationale before request the user's consent. Returns the
list of permissions that can only be changed via user's intervention.
override
-
showAlarmPage(
) → Future< void> -
Opens the app notifications page
override
-
showGlobalDndOverridePage(
) → Future< void> -
Opens the app page to allows to override device DnD
override
-
showNotificationConfigPage(
{String? channelKey}) → Future< void> -
Opens the app notifications page
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited