Push class

The interface that implementations of push must implement.

Platform implementations must extend this class rather than implement it as push does not consider newly added methods to be breaking changes.

This is because of the differences between:

  • Extending this class (using extends): implementation gets default implementation, so no work is needed except updating the dependency version.
  • Implementing this class (using implements): interface will be broken by newly added methods, meaning more code to be added (more work), but custom implementation (more control).
Inheritance
  • Object
  • PlatformInterface
  • Push

Constructors

Push()

Properties

hashCode int
The hash code for this object.
no setterinherited
notificationTapWhichLaunchedAppFromTerminated Future<Map<String?, Object?>?>
Get the notification tapped by the user when the app was in the terminated state. This does not include the case where a push notification is received when the app is in the background but still running.
no setter
onNewToken Stream<String>
A new FCM registration token update. (Passing the result of FirebaseMessagingService#onNewToken to Flutter app)
no setter
onNotificationTap Stream<Map<String?, Object?>>
Notification that was tapped whilst the app is already running in the foreground or background. This requires the notification to contain data. The actual notification is not available. This is an intermittently working feature. Sometimes, Android delivers an intent with no extras, meaning we can't provide the notification from ther user.
no setter
onOpenSettingsHandler VoidCallback?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
token Future<String?>
Get the token identifying the device for push notifications.
no setter

Methods

addOnBackgroundMessage(MessageHandler handler) VoidCallback
Called when notification is received when app is terminated or in the background.
addOnMessage(MessageHandler handler) VoidCallback
Called when notification is received when app is in the foreground. Remember to unsubscribe. Multiple listeners can be listening.
areNotificationsEnabled() Future<bool>
getNotificationSettings() Future<UNNotificationSettings>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestPermission({bool badge = true, bool sound = true, bool alert = true, bool carPlay = true, bool criticalAlert = false, bool provisional = false, bool providesAppNotificationSettings = false, bool announcement = true}) Future<bool>
For more information, see the underlying Apple documentation.
resetHandlers() → void
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance Push
The default instance of Push to use.
getter/setter pair