Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected

type mismatch: inferred type is string but charset was expected
type mismatch: inferred type is boolean but boolean was expected
mainactivity.kt type mismatch: inferred type is flutterengine but pluginregistry! was expected
application kt 16 44 type mismatch: inferred type is pluginregistry but flutterengine was expected
type mismatch: inferred type is view but view was expected
application kt 17 48 type mismatch inferred type is pluginregistry but flutterengine was expected
type mismatch inferred type is shimpluginregistry but flutterengine was expected
kotlin type mismatch inferred type is mainactivity but flutterengine was expected

I want to work with Flutter Workmanager, I did the cited configuration in my .kt like this:

package com.example.mybackprocess

import be.tramckrijte.workmanager.WorkmanagerPlugin
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.GeneratedPluginRegistrant

class App : FlutterApplication(), PluginRegistry.PluginRegistrantCallback {
    override fun onCreate() {
        super.onCreate()
        WorkmanagerPlugin.setPluginRegistrantCallback(this)
    }

    override fun registerWith(reg: PluginRegistry?) {
        GeneratedPluginRegistrant.registerWith(reg)
    }
}

and I have changed android:name to

android:name=".App"

but it gives me this error:

Launching lib\main.dart on G3212 in debug mode... e:E:\mybackprocess\android\app\src\main\kotlin\com\example\mybackprocess\MainActivity.kt: (15, 48): Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected

FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugKotlin'. Compilation error. See log for more details

Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org

BUILD FAILED in 55s Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

Can someone please help me?


you can fix the issue by replacing the following method in your application.kt

override fun registerWith(registry: PluginRegistry?) {
    registry?.registrarFor("com.iotecksolutions.background_location_fetch.BackgroundLocationFetchPlugin");
}

Note: Replace com.iotecksolutions.background_location_fetch.BackgroundLocationFetchPlugin with your plugin name.

inferred type is FlutterEngine but PluginRegistry! was , and then it gave this error : Type mismatch: inferred type is Flutt inferred type is FlutterEngine but PluginRegistry! was expected #45231. [firebase_messaging] Application.kt: Type mismatch: inferred type is PluginRegistry but FlutterEngine was expected #1684 Open ManuelDiPietro opened this issue Dec 20, 2019 · 47 comments


Replace the MainActivity.kt with:

import android.os.Bundle
import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity : FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        GeneratedPluginRegistrant.registerWith(this)
    }
}

[firebase_messaging] Type mismatch: inferred type is PluginRegistry , Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected #1613. Open. Jacobsjj2 opened this issue on Dec 11, 2019 � 7 comments. [firebase_messaging] Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected #1613 Jacobsjj2 opened this issue Dec 12, 2019 · 7 comments Labels


I used the following code to fix the error GeneratedPluginRegistrant.registerWith(FlutterEngine(applicationContext))

Type mismatch: inferred type is PluginRegistry? but FlutterEngine , you can fix the issue by replacing the following method in your application.kt override fun registerWith(registry: PluginRegistry?) { registry? e: MainActivity.kt: (10, 48): Type mismatch: inferred type is FlutterEngine but PluginRegistry! was expected FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileReleaseKotlin'.


Type mismatch: inferred type is PluginRegistry?, Using the PluginRegistry provided by the method throws the error. Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected. Please see� C:\Users\ajanuw\Desktop\flutter_video_app\android\app\src\main\kotlin\com\ajanuw\flutter_video_app\MyApplication.kt: (10, 48): Type mismatch: inferred type is PluginRegistry but FlutterEngine was expected MyApplication.kt


Type mismatch: inferred type is PluginRegistry but FlutterEngine , Spring Boot golang. Ask questions[firebase_messaging] Application.kt: Type mismatch: inferred type is PluginRegistry but FlutterEngine was expected� I have followed same instruction for platform setup, but my stacktrace looks like this: kt: (15, 48): Type mismatch: inferred type is PluginRegistry? but FlutterEngine was expected FAILURE: Build failed with an exception.


inferred type is FlutterEngine but PluginRegistry! was expected , option and then it gave this error : Type mismatch: inferred type is FlutterEngine but PluginRegistry! was expected . I removed the code which� Type mismatch: inferred type is LoginActivity but LifecycleOwner was expected Here is the code snippet on which it is showing the error: