FirebaseMessagingPlatform class abstract

Defines an interface to work with Messaging on web and mobile.

Inheritance
  • Object
  • PlatformInterface
  • FirebaseMessagingPlatform

Constructors

FirebaseMessagingPlatform({FirebaseApp? appInstance})
Create an instance using app.
FirebaseMessagingPlatform.instanceFor({required FirebaseApp app, required Map pluginConstants})
Create an instance with a FirebaseApp using an existing instance.
factory

Properties

app → FirebaseApp
Returns the FirebaseApp for the current instance.
no setter
appInstance → FirebaseApp?
The FirebaseApp this instance was initialized with.
final
hashCode int
The hash code for this object.
no setterinherited
isAutoInitEnabled bool
Returns whether messaging auto initialization is enabled or disabled for the device.
no setter
onTokenRefresh Stream<String>
Fires when a new FCM token is generated.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delegateFor({required FirebaseApp app}) FirebaseMessagingPlatform
Enables delegates to create new instances of themselves if a none default FirebaseApp instance is required by the user.
deleteToken() Future<void>
Removes access to an FCM token previously authorized with optional senderId.
getAPNSToken() Future<String?>
On iOS & MacOS, it is possible to get the users APNs token. This may be required if you want to send messages to your iOS devices without using the FCM service.
getInitialMessage() Future<RemoteMessage?>
If the application has been opened from a terminated state via a RemoteMessage (containing a Notification), it will be returned, otherwise it will be null.
getNotificationSettings() Future<NotificationSettings>
Returns the current NotificationSettings.
getToken({String? vapidKey}) Future<String?>
Returns the default FCM token for this device and optionally senderId.
isSupported() Future<bool>
isSupported() informs web users whether the browser supports Firebase.Messaging
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerBackgroundMessageHandler(BackgroundMessageHandler handler) → void
Allows delegates to create a background message handler implementation.
requestPermission({bool alert = true, bool announcement = false, bool badge = true, bool carPlay = false, bool criticalAlert = false, bool provisional = false, bool sound = true}) Future<NotificationSettings>
Prompts the user for notification permissions.
sendMessage({required String to, Map<String, String>? data, String? collapseKey, String? messageId, String? messageType, int? ttl}) Future<void>
Send a new RemoteMessage to the FCM server.
setAutoInitEnabled(bool enabled) Future<void>
Enable or disable auto-initialization of Firebase Cloud Messaging.
setDeliveryMetricsExportToBigQuery(bool enabled) Future<void>
Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery.
setForegroundNotificationPresentationOptions({required bool alert, required bool badge, required bool sound}) Future<void>
Sets the presentation options for iOS based notifications when received in the foreground.
setInitialValues({bool? isAutoInitEnabled}) FirebaseMessagingPlatform
Sets any initial values on the instance.
subscribeToTopic(String topic) Future<void>
Subscribe to topic in background.
toString() String
A string representation of this object.
inherited
unsubscribeFromTopic(String topic) Future<void>
Unsubscribe from topic in background.

Operators

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

Static Properties

instance FirebaseMessagingPlatform
The current default FirebaseMessagingPlatform instance.
getter/setter pair
onBackgroundMessage BackgroundMessageHandler?
Set a message handler function which is called when the app is in the background or terminated.
getter/setter pair
onMessage StreamController<RemoteMessage>
Returns a Stream that is called when an incoming FCM payload is received whilst the Flutter instance is in the foreground.
final
onMessageOpenedApp StreamController<RemoteMessage>
Returns a Stream that is called when a user presses a notification displayed via FCM.
final