firebase_messaging_web
4.4.0, released 4 days ago by firebase.google.com
Web implementation of Firebase Cloud Messaging for push notifications.
What it does
Provides the web side of Firebase Messaging, allowing Flutter web apps to receive push notifications via Firebase Cloud Messaging. It registers service workers and handles token management and message callbacks.
AI-written summary of version 4.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need push notifications in a Flutter web app using Firebase
- You already use other Firebase services like firebase_core
- You want a simple integration without custom native code
Skip it when
- You target only mobile platforms
- You need a non‑Firebase push solution
Strengths
- Official Firebase support
- Works seamlessly with other FlutterFire packages
- Handles service‑worker registration and token retrieval
Weaknesses
- Web‑only; no mobile support
- Limited to Firebase ecosystem
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Add firebase_core and firebase_core_web, configure Firebase project, ensure a service worker file is present as described in Firebase docs
import 'package:firebase_messaging_web/firebase_messaging_web.dart';
void main() async {
FirebaseMessaging messaging = FirebaseMessaging.instance;
String? token = await messaging.getToken();
print('FCM token: $token');
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print('Received message: ${message.notification?.title}');
});
}Alternatives
Packages that do the same job and could replace firebase_messaging_web.
- awesome_notifications_fcm
Firebase Cloud Messaging integration for awesome_notifications push features
72Compare - firebase_messaging_handler
Unified Firebase Cloud Messaging handler with inbox, scheduling, and in‑app messaging for Flutter
68Compare - fcm_actions
Production-ready FCM actions, tokens, topics, and routing for Flutter apps.
65Compare - firebase_notifications_handler
Handle Firebase Cloud Messaging notifications with built-in local notifications support.
63Compare
Works with
Packages commonly used together with firebase_messaging_web: ones it builds on, ones built on it, and its own family.
- webfirebase_messaging_web depends on itLightweight bindings for browser APIs via JS interop
- firebase_corefirebase_messaging_web depends on itFlutter plugin that initializes Firebase and allows multiple Firebase app connections.
- firebase_core_webfirebase_messaging_web depends on itWeb implementation of firebase_core for Flutter apps.
- firebase_analyticsSame familyFlutter plugin for Google Analytics for Firebase.
- firebase_crashlyticsSame familyFlutter plugin that sends uncaught errors and crash reports to Firebase Crashlytics.
- firebase_authSame familyFlutter plugin for Firebase Authentication enabling passwords, phone numbers, and identity providers.
- firebase_auth_webSame familyWeb implementation of Firebase Authentication for Flutter
- cloud_firestoreSame familyFlutter plugin for Cloud Firestore noSQL database with live synchronization.