Flutterfire: [firebase_messaging] documentation need to be updated to import and parse the correct flutter engine class

Created on 7 Aug 2020  路  3Comments  路  Source: FirebaseExtended/flutterfire

this should be the correct syntax of the application class

package YOUR.PACKAGE.NAME;

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;//<-- the correct import here
import io.flutter.embedding.engine.FlutterEngine;

public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}

@Override
public void registerWith(PluginRegistry registry) {
FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}

messaging documentation

Most helpful comment

Yes, you're absolutely correct. Today itself I was following those old dead steps as available on the package page and ended up with errors. The readme.md file is so outdated and even example app is so dead. Kindly, update it. It's so confusing for us, at least for me.

All 3 comments

Currently in readme.md, it has:

@Override
  public void registerWith(PluginRegistry registry) {
    GeneratedPluginRegistrant.registerWith(registry);
  }

@darshankawar
it's not working
the project is not even running
I just found the best solution
https://stackoverflow.com/a/60958130/6118808

Yes, you're absolutely correct. Today itself I was following those old dead steps as available on the package page and ended up with errors. The readme.md file is so outdated and even example app is so dead. Kindly, update it. It's so confusing for us, at least for me.

Was this page helpful?
0 / 5 - 0 ratings