← ClaudeAtlas

flutter-firebase-messaginglisted

Firebase Cloud Messaging (FCM) push notifications
noory-code/noory-ai · ★ 0 · AI & Automation · score 74
Install: claude install-skill noory-code/noory-ai
# Flutter Firebase Messaging Receive remote push notifications via Firebase Cloud Messaging. --- ## Installation ```bash flutter pub add firebase_messaging flutter pub add flutter_local_notifications # for foreground notification display ``` ## Prerequisites - Firebase project configured - `flutterfire configure` has been run - iOS: APNs certificate or key registered in Firebase --- ## Quick Reference ### Initialization and Permissions ```dart import 'package:firebase_messaging/firebase_messaging.dart'; Future<void> initFCM() async { final messaging = FirebaseMessaging.instance; // request permissions final settings = await messaging.requestPermission( alert: true, badge: true, sound: true, ); if (settings.authorizationStatus == AuthorizationStatus.authorized) { print('Notification permission granted'); } // get FCM token final token = await messaging.getToken(); print('FCM Token: $token'); // token refresh listener messaging.onTokenRefresh.listen((newToken) { // send new token to server updateTokenOnServer(newToken); }); } ``` ### Setting Up Message Handlers ```dart void setupMessageHandlers() { // foreground message FirebaseMessaging.onMessage.listen((message) { print('Foreground message: ${message.notification?.title}'); // display as local notification showLocalNotification(message); }); // notification tap from background FirebaseMessaging.onMessageOpenedApp.listen((message) { pr