Flutter Push Notifications FCM Tutorial: Zero to Send
This Flutter push notifications FCM tutorial covers the full integration: tokens, foreground, background, tap handling, iOS setup, and the failures everyone hits.
Push notifications are a rite of passage for Flutter developers — and one of the most failure-prone integrations in the ecosystem. This Flutter push notifications FCM tutorial takes you from a bare project to a working notification pipeline: Firebase setup, FCM tokens, foreground display, background handlers, tap-to-navigate, iOS APNs configuration, and a troubleshooting section for every silent failure I've seen in production. What you'll learn Setting up Firebase and adding firebase_messaging on Flutter 3.x Requesting notification permission (incl. Android 13 changes) Getting and refreshing the FCM token Handling messages in foreground, background, and terminated states Navigating to a screen when a notification is tapped Data vs notification payloads iOS setup with an APNs key Creating Android notification channels Debugging the classic silent failures Step 1 — Set up Firebase and add the package In the Firebase console, create a project and register both your Android and iOS apps, then download google-services.json (Android → android/app/ ) and GoogleService-Info.plist (iOS → ios/Runner/ ). Add the FlutterFire packages: flutter pub add firebase_core firebase_messaging Initialize Firebase before the app runs: import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); await PushService.initialize(); runApp(const MyApp()); } PushService.initialize() (built below) registers the background handler, requests permission, and subscribes to the message streams — all in one place so main stays readable. Step 2 — Request permission Notifications need explicit permission. iOS always prompts; Android 13+ does too, so…