FcmIdentityConfig class

Configuration passed to FcmIdentity.init.

Constructors

FcmIdentityConfig({required DeviceRegistrar registrar, FirebaseOptions? firebaseOptions, String? appId, bool registerAnonymousDevices = false, bool deleteTokenOnLogout = true, bool requestPermissionOnInit = false, bool showForegroundNotifications = true, String topicPrefix = '', String androidChannelId = 'fcm_identity_default', String androidChannelName = 'Notifications', String androidChannelDescription = 'General notifications', String androidIcon = '@mipmap/ic_launcher', String? webVapidKey, BackgroundMessageHandler? backgroundHandler, void onMessage(PushMessage message)?, void onMessageOpened(PushMessage message)?, void onError(Object error, StackTrace stackTrace)?})
Creates a configuration. Only registrar is required.
const

Properties

androidChannelDescription → String
Android notification channel description.
final
androidChannelId → String
Android notification channel id. Also set it in AndroidManifest as com.google.firebase.messaging.default_notification_channel_id.
final
androidChannelName → String
Android notification channel name shown in system settings.
final
androidIcon → String
Android small icon resource.
final
appId → String?
Optional app identifier included in every registration.
final
backgroundHandler → BackgroundMessageHandler?
Your own background handler. Must be a top-level function annotated with @pragma('vm:entry-point').
final
deleteTokenOnLogout → bool
Delete the FCM token on logout so the device stops receiving notifications that were addressed to the previous user.
final
firebaseOptions → FirebaseOptions?
Usually DefaultFirebaseOptions.currentPlatform from flutterfire configure. If null, the native config files are used.
final
hashCode → int
The hash code for this object.
no setterinherited
onError → void Function(Object error, StackTrace stackTrace)?
Called when syncing with the backend or Firebase fails.
final
onMessage → void Function(PushMessage message)?
Called when a message arrives while the app is in the foreground.
final
onMessageOpened → void Function(PushMessage message)?
Called when the user taps a notification while the app is running or in the background. For cold starts use takeInitialMessage.
final
registerAnonymousDevices → bool
Register devices with your backend even before login is called (with userId: null). Useful for broadcast-only apps.
final
registrar → DeviceRegistrar
Where device registrations are sent: your backend.
final
requestPermissionOnInit → bool
Ask for notification permission during init. Prefer false and call FcmIdentity.requestPermission after explaining why.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showForegroundNotifications → bool
Show notifications while the app is in the foreground.
final
topicPrefix → String
Prefix added to every topic name; avoids clashes when several apps share one Firebase project.
final
webVapidKey → String?
VAPID key, required on web only.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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