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:

Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 â‹… 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 â‹… 5 min read
Deno logo over an orange background

How to migrate your Node.js app to Deno 2.0

Deno is a popular JavaScript runtime, and it recently launched version 2.0 with several new features, bug fixes, and improvements […]

Yashodhan Joshi
Dec 17, 2024 â‹… 7 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