fcm_identity library

OneSignal-style push notifications on top of Firebase Cloud Messaging.

Call FcmIdentity.init once at startup, FcmIdentity.login when a user signs in and FcmIdentity.logout when they sign out. Device tokens are synced to your own backend through a DeviceRegistrar.

Classes

CallbackRegistrar
A DeviceRegistrar backed by two functions, for full control.
DeviceRegistrar
Sends device registrations to your backend.
DeviceRegistration
Everything your backend needs to know about one device.
FcmIdentity
OneSignal-style facade over Firebase Cloud Messaging.
FcmIdentityConfig
Configuration passed to FcmIdentity.init.
HttpRegistrar
A DeviceRegistrar that talks JSON over HTTP.
PushMessage
A platform-independent view of a received push notification.

Typedefs

BodyBuilder = Map<String, Object?> Function(DeviceRegistration registration)
Builds a custom JSON body if your backend expects a different shape.
HeadersBuilder = FutureOr<Map<String, String>> Function()
Builds request headers, e.g. a fresh Authorization header.

Exceptions / Errors

RegistrationException
Thrown by HttpRegistrar when the backend answers with a non-2xx status.