firebase_cloud_messaging_flutter 2.1.0
firebase_cloud_messaging_flutter: ^2.1.0 copied to clipboard
Send Firebase Cloud Messages and manage topics directly from your Dart or Flutter application using the FCM HTTP v1 API. No external server required. Includes native Google Application Default Creden [...]
2.1.0 #
This release elevates the package to a production-hardened server-side SDK by introducing native ambient credentials and dedicated topic management.
- Feat (Auth): Introduced
FirebaseCloudMessagingServer.applicationDefault({ required String projectId }). Supports Google Application Default Credentials (ADC) for seamless authentication in Cloud Run, App Engine, and Firebase Functions. - Feat (Topic Management): Added
subscribeTokensToTopic()andunsubscribeTokensFromTopic(). These utilize the Firebase Instance ID API for efficient batch management (up to 1,000 tokens per request). - Refactor (Architecture): Introduced
FcmTopicManagementinternal class to centralize topic lifecycle logic. - Refactor (Breaking): Migrated project-wide filename convention to standard Dart snake_case (e.g.,
android_config.dart). All internal imports and public exports have been updated. - Hardening: Consolidated network logic into a shared, reusable
http.Clientto prevent socket leaks. - Typing: Added missing priority and visibility fields to platform-specific configs.
2.0.0 #
Breaking Changes #
AndroidMessagePriority.normaland.highnow serialize to"NORMAL"and"HIGH"respectively.FirebaseWebpushConfig.notificationchanged to typedFirebaseWebpushNotification.FirebaseWebpushConfig.webPushFcmOptionsrenamed tofcmOptions.ServerResult.messageSentis now nullable.json_serializablemoved todev_dependencies.
New Features #
sendToMultiple()— sends to many tokens in parallel.sendToTopic()— targeted topic messages.sendToCondition()— targeted condition messages.validateMessage()— dry-run support.onRegistrationChange— registration status callback.FcmLogger— structured logging.FcmRetryConfig— exponential back-off retries.FirebaseCloudMessagingServer.fromServiceAccountJson()— load from JSON string.FirebaseCloudMessagingServer.fromServiceAccountFile()— load from File.dispose()— clean resource cleanup.FcmError+FcmErrorCode— typed FCM error extracted from failed requests. responses. UseisRetryableto decide whether to back off.BatchResult/TokenResult— aggregated result fromsendToMultiple.
API Completeness #
FirebaseApnsConfig— added typednotification(FirebaseApnsNotification) andfcmOptions(ApnsFcmOptions). Rawpayloadmap preserved for advanced APS dictionary use.- New
apns.notification.dart—FirebaseApnsNotification,ApnsAlert,ApnsFcmOptions. FirebaseWebpushConfig— replaced rawMapfields with typedFirebaseWebpushNotificationandWebpushFcmOptions.- New
webpush.notification.dart—FirebaseWebpushNotification,WebpushAction,WebpushFcmOptions. FirebaseFcmOptions— added missingimagefield.FirebaseAndroidConfig— addeddirectBootOk(direct_boot_ok) field.FirebaseAndroidNotification— addedproxyfield withAndroidNotificationProxyenum.
Bug Fixes #
- Fixed HTTP client leak: a single
http.Clientis now reused across all send calls and closed viadispose(). Previously a new client was created (and leaked) on everysend()invocation. - Fixed
projectIDbeing re-parsed from JSON on every request; now cached at construction time.
Quality #
- Added
copyWith()toFirebaseMessage,FirebaseSend, andServerResult. - Added
ServerResult.errorBody(raw response body on failure) andServerResult.fcmError(typed error). FirebaseSendnow asserts thatmessageis non-null at construction time.- Added full unit test suite in
test/. - Updated all dev dependencies to latest versions.
- Updated minimum SDK to
>=2.17.0.
1.0.6 #
- Updated dependencies
- Thanks to @dsyrstad
- Made fixes to .gitignore and removed pubspec.lock to make it conform to a standard Dart package project.
- Upgraded to support Dart 3.0+.
- Fixed commenting — replacing /// with // where appropriate.
- Support Webpush fcm_options and support proper notification object.
1.0.5 #
- Improved code structure and quality
1.0.4 #
- Updated dependencies
- Improved code structure and quality
1.0.3 #
- Improved code structure and quality
1.0.2 #
- Updated Dependencies
1.0.1 #
- Improved Example and Document File
1.0.0 #
- Initial version, minor things missing