Fixing the glitches while setting up push notifications for your Flutter project

A comprehensive guide on setting up notifications

Setting up and fixing possible errors

Import the package into your Flutter app. Go through each and every installation step. You may run into few errors here when running the app.

  1. The first error could be in your file. Make sure the IDE doesn’t give any warning signs. If there are no warning signs, then there is no need to change. If it does at this line, consider changing the registerWith method as below.
// The error line

As of this writing, you need to change the registerWith method as follows.

public void registerWith(PluginRegistry registry) {
    GeneratedPluginRegistrant.registerWith((FlutterEngine) registry);

This has not been documented yet.

Make sure the android/app/build.grade file has the correct dependencies

dependencies {
    implementation ''
    implementation ''

Your intent filters should be correct

    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    <action android:name="FLUTTER_NOTIFICATION_CLICK" />
    <category android:name="android.intent.category.DEFAULT" />

The FLUTTER_NOTIFICATION_CLICK should be added as a separate intent-filter but not inside the existing one.

Create Firebase project

Your Firebase project will verify your app by the application_id and the google-services.json file it generated while creating an Android project form the dashboard.

At this time, you must reinstall the app on your AVD or physical device. The notifications will only be pushed once firebase verifies your app.

Mandatory Code Before writing your own implementation of how notifications should be handled, keep this code to test whether you did all the steps correctly.

// Inside a stateful widget
void initState() {
  final fbm = FirebaseMessaging();
  fbm.configure(onMessage: (msg) {
  }, onLaunch: (msg) {
  }, onResume: (msg) {

Start pushing notification from the Firebase console.

#firebase cloud messaging