2022-03-15
2896
#firebase#flutter
Souvik Biswas
34925
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:

Vue logo over a brown background.

A guide to two-way binding in Vue

Learn how to implement one-way and two-way data binding in Vue.js, using v-model and advanced techniques like defineModel for better apps.

David Omotayo
Nov 22, 2024 â‹… 10 min read
TypeScript logo over a pink and white background.

Drizzle vs. Prisma: Which ORM is best for your project?

Compare Prisma and Drizzle ORMs to learn their differences, strengths, and weaknesses for data access and migrations.

Temitope Oyedele
Nov 21, 2024 â‹… 10 min read
Practical Implementation Of The Rule Of Least Power For Developers

Practical implementation of the Rule of Least Power for developers

It’s easy for devs to default to JavaScript to fix every problem. Let’s use the RoLP to find simpler alternatives with HTML and CSS.

Timonwa Akintokun
Nov 21, 2024 â‹… 8 min read
Rust logo over black marble background.

Handling memory leaks in Rust

Learn how to manage memory leaks in Rust, avoid unsafe behavior, and use tools like weak references to ensure efficient programs.

Ukeje Goodness
Nov 20, 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:

    FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler)

    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