Souvik Biswas
Mar 15, 2022 ⋅ 10 min read

Add Flutter push notifications with Firebase Cloud Messaging

Souvik Biswas Mobile developer (Android, iOS, and Flutter), technical writer, IoT enthusiast, avid video game player.

Recent posts:

Exploring Stylex And The New Generation Of Styling Libraries

Exploring StyleX and the new generation of styling libraries

StyleX is a build-time, type-safe CSS-in-JS library recently open sourced by Meta. Explore StyleX and the evolution of styling libraries.

Ibadehin Mojeed
Feb 29, 2024 ⋅ 9 min read
Building High Performance Ecommerce Sites With Astro

Building high-performance ecommerce sites with Astro

Learn to set up a completely custom Astro ecommerce implementation that’s also highly performant and type-safe in this straightforward guide.

Onuorah Bonaventure
Feb 28, 2024 ⋅ 64 min read
Implementing Vector Search With Open Ai, Next Js, And Supabase

Implementing vector search with OpenAI, Next.js, and Supabase

Let’s build a Next.js app that implements vector search using Supabase and OpenAI to offer better search experiences for users.

Peter Ekene Eze
Feb 27, 2024 ⋅ 11 min read
Comparing React Native BLE libraries

Comparing React Native BLE libraries

Discover the most popular libraries for enabling Bluetooth Low Energy (BLE) in React Native apps, allowing them to interact with Bluetooth hardware on iOS and Android platforms.

Fimber Elemuwa
Feb 26, 2024 ⋅ 4 min read
View all posts

22 Replies to "Add Flutter push notifications with Firebase Cloud Messaging"

  1. That’s version 7 of FirebaseMessaging. The lastest version 9 it’s completely different. It requires to be configured with streams. Also you can’t instantiate FirebaseMessaging anymore and you can’t get tokens like that. I readed the documentation but I can’t implement it. I thought this tutorial was updated but it’s not.

    1. Have you found a way to implement yet? I hate how bad at documentation google is. It’s too mixed with web, ios, android, etc

  2. Hello sir ,
    I used your code and every thing running successfully but notification are not showing > on message method also not able to calling .

  3. Everything works fine with this even in Firebase Messaging 11.2.11 however there is an issue with the line:


    throwing an exception:

    _CastError (Null check operator used on a null value)

    It only does this on Android, not on iOS. I don’t have an Android device to check with so it might be because I’m running on the Android simulator? Any clarification welcome. Thanks!

  4. A big “Thank You” for this detailed guide
    _firebaseMessagingBackgroundHandler is received notification data and print on console, however, app in background or terminated remains in background / terminated. pls what am i doing wrong? my expectation is that app should pop up from background or wake up from termination.

    I want to received backgroundmessage and launch a specific screen.
    According to documentation, “Since the handler runs in its own isolate outside your applications context, it is not possible to update application state or execute any UI impacting logic.”

    I came across service extension but no clear guideline for implementation

  5. Nice post man. but i have 2 questions:

    – How to subscribe to a default topic automatic? where the best place to do that?
    – What can I do to see if token are refreshed? Some event like OnTokenRefresh, I want to do some http request

  6. Nice one sir. Very resourceful and the flow is quite explanatory. The author missed out calling the registerNotification() function in the initState() method, after adding that, everything works nice

Leave a Reply