incompatible types: MainActivity cannot be converted to FlutterEngine GeneratedPluginRegistrant.registerWith(this); code example

Example: PluginRegistry cannot be converted to FlutterEngine GeneratedPluginRegistrant.registerWith(registry)

import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;
//replace GeneratedPluginRegistrant.registerWith(registry); with below
FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));

Tags:

Misc Example