firebase_cloud_messaging_flutter library

Firebase Cloud Messaging for Dart & Flutter — Server-side SDK

Sends FCM messages directly via the HTTP v1 REST API without requiring an external server. Supports Android, iOS (APNs), and Web (WebPush) targets.

Getting started

import 'package:firebase_cloud_messaging_flutter/firebase_cloud_messaging_flutter.dart';

See FirebaseCloudMessagingServer for the primary entry point.

Classes

ApnsAlert
The structured alert body displayed by iOS for a notification.
ApnsFcmOptions
FCM-specific options that overlay on top of the APNs delivery channel.
BatchResult
Aggregated result from FirebaseCloudMessagingServer.sendToMultiple.
FCMColor
An RGBA colour value used in FCM notification models.
FcmError
A structured representation of an error returned by the FCM HTTP v1 API.
FcmRetryConfig
Controls how FirebaseCloudMessagingServer retries failed send requests.
FirebaseAndroidConfig
Android-specific configuration for an FCM message.
FirebaseAndroidNotification
Android-specific notification content for FCM messages.
FirebaseApnsConfig
Configuration for messages sent through the Apple Push Notification Service (APNs) channel.
FirebaseApnsNotification
Typed APNs notification that replaces the raw payload Map in FirebaseApnsConfig.
FirebaseCloudMessagingServer
A server-side client for sending Firebase Cloud Messages via the FCM HTTP v1 API directly from Dart or Flutter.
FirebaseFcmOptions
Cross-platform FCM options that apply regardless of the target channel (Android, iOS, or Web).
FirebaseMessage
The core FCM message object.
FirebaseNotification
FirebaseSend
The top-level request wrapper sent to the FCM HTTP v1 API.
FirebaseServiceModel
FirebaseWebpushConfig
Configuration for messages delivered through the Web Push protocol.
FirebaseWebpushNotification
A typed Web Notification object for the webpush channel.
LightSettings
Controls the notification LED blinking rate and colour.
ServerResult
Holds the outcome of a single FCM send request.
TokenResult
Result types returned by FirebaseCloudMessagingServer.sendToMultiple.
TopicManagementResult
The aggregate result from a batch subscribe/unsubscribe operation.
TopicManagementTokenResult
The result for a single token when subscribing or unsubscribing to a topic.
WebpushAction
A button that appears in an expanded web push notification.
WebpushFcmOptions
FCM-specific options that apply on top of the webpush delivery channel.

Enums

AndroidMessagePriority
Delivery priority for an Android FCM message.
AndroidNotificationProxy
Controls proxy behaviour for notifications through trusted applications.
FcmErrorCode
Known error codes returned by the FCM HTTP v1 API.
FcmLogLevel
Severity levels for FCM log messages, ordered from least to most severe.
FcmRegistrationStatus
Status of a device token after an FCM attempt.
InterruptionLevel
Typed model for Apple Push Notification Service (APNs) notifications.
NotificationPriority
Display priority of a notification on the device (client-side concept).
Visibility
Controls how much of the notification is visible on the lock screen.
WebpushDirection
Typed models for Web Push notifications delivered through FCM.

Functions

fcmSilentLogger(FcmLogLevel level, String message, {Object? error, StackTrace? stackTrace}) → void
A do-nothing logger that silences all output from the server. This is the default when no FcmLogger is supplied.

Typedefs

FcmLogger = void Function(FcmLogLevel level, String message, {Object? error, StackTrace? stackTrace})
A callback that receives structured log output from FirebaseCloudMessagingServer.
FcmRegistrationCallback = void Function(String token, FcmRegistrationStatus status)
A callback triggered when a specific device token's registration status changes.