Beginning FlutterFire

Aug 30 2022 · Dart 2.16, Flutter 3.0, Visual Studio Code 1.69

Part 5: Add Notifications with Firebase Cloud Messaging

22. Add Cloud Messaging to Your App

Episode complete

Play next episode

About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 21. Leverage Firebase Cloud Messaging Next episode: 23. Set Cloud Messaging Permissions on iOS

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

The Flutterfire plugin that adds the Cloud Messaging capabilities is called firebase_messaging.

flutter pub add firebase_messaging 
import 'package:firebase_messaging/firebase_messaging.dart'; 
final messaging = FirebaseMessaging.instance; 
Future<void> _handleMessage(RemoteMessage message) async { 
  print('background message title ${message.notification!.title}'); 
  print('background message body ${message.notification!.body}'); 
  print('background data ${}'); 
FirebaseMessaging.onMessage.listen((RemoteMessage message) { 
    print('Message received in the foreground!'); 
    if (message.notification != null) { 
          'Message notification: ${message.notification?.body}');