title: flutter: FlutterFcmService - Fatal: failed to find callback
body: <p>I want to use fcm on my flutter app so after creating firebase console and installed some dependancies in my gradle like this:</p>
  <p>build.gradle: Project</p>
  <pre><code>dependencies {
      classpath 'com.android.tools.build:gradle:3.5.0'
      classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;
      classpath 'com.google.gms:google-services:4.3.3'
  }
  </code></pre>
  <p>build.gradle: App</p>
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply from: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;
  apply plugin: 'com.google.gms.google-services'
  ...
  dependencies {
      implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
      implementation 'com.google.firebase:firebase-analytics:17.5.0'
      implementation 'com.google.firebase:firebase-messaging:20.2.4'
  }
  </code></pre>
  <p>And create a Java Application class:</p>
  <pre><code>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.FirebaseMessagingPlugin;
  import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
  
  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(&quot;io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin&quot;));
      }
  }
  </code></pre>
  <p>And add this app class and intent-filter in manifest:</p>
  <pre><code>&lt;application
      android:name=&quot;.Application&quot;
      android:label=&quot;sian_mobile&quot;
      android:icon=&quot;@mipmap/ic_launcher&quot;&gt;
      &lt;activity
          android:name=&quot;.MainActivity&quot;
      ...
                  &lt;intent-filter&gt;
              &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;
              &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;
          &lt;/intent-filter&gt;
          &lt;intent-filter&gt;
              &lt;action android:name=&quot;FLUTTER_NOTIFICATION_CLICK&quot; /&gt;
              &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
          &lt;/intent-filter&gt;
  </code></pre>
  <p>And install <code>firebase_messaging: ^7.0.0</code> in pubspect</p>
  <p>I write this simple FirebaseMessaging code:</p>
  <pre><code>  FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
    @override
    void initState() {
      super.initState();
  
      _firebaseMessaging.configure(
        onMessage: (message) async {
          print(&quot;-------&gt; $message&quot;);
        },
        onResume: (message) async {
          print(&quot;-------&gt; $message&quot;);
        },
        onLaunch: (message) async {},
      );
    }
  </code></pre>
  <p>When i run application and app is on forground i push notification from console to app. in vscode console i got this errors:</p>
  <pre><code>Installing build/app/outputs/flutter-apk/app.apk...
  E/FlutterFcmService(11005): Fatal: failed to find callback
  Connecting to VM Service at ws://127.0.0.1:41113/PSCQfaDH4oA=/ws
  D/EGL_emulation(11005): eglMakeCurrent: 0xe83ba420: ver 2 0 (tinfo 0xc80dd6e0)
  W/.sian_mobil(11005): Accessing hidden method Landroid/os/WorkSource;-&gt;add(I)Z (greylist, reflection, allowed)
  W/.sian_mobil(11005): Accessing hidden method Landroid/os/WorkSource;-&gt;add(ILjava/lang/String;)Z (greylist, reflection, allowed)
  W/.sian_mobil(11005): Accessing hidden method Landroid/os/WorkSource;-&gt;size()I (greylist, reflection, allowed)
  W/.sian_mobil(11005): Accessing hidden method Landroid/os/WorkSource;-&gt;get(I)I (greylist, reflection, allowed)
  W/.ian_mobil(11005): Accessing hidden method Landroid/os/WorkSource;-&gt;getName(I)Ljava/lang/String; (greylist, reflection, allowed)
  I/flutter (11005): -------&gt; {notification: {title: test title, body: Test notification text}, data: {}}
  </code></pre>