olexale / flutter_mrz_scanner

Scans MRZ (Machine Readable Zone) from identity documents.
MIT License
51 stars 43 forks source link

'MRZScannerFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView #18

Open Kolloshe opened 2 years ago

Kolloshe commented 2 years ago

Class 'MRZScannerFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory

flutter_mrz_scanner-2.0.0/android/src/main/kotlin/io/github/olexale/flutter_mrz_scanner/FlutterMrzScannerPlugin.kt: (30, 5): 'create' overrides nothing

sahil-innostax commented 2 years ago

facing the same issue with Flutter 3

beratpolat commented 2 years ago

It's error from null safety of kotlin

please try below in FlutterMrzScannerPlugin.kt

class MRZScannerFactory(private val messenger: BinaryMessenger) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {

override fun create(context: Context?, id: Int, o: Any?): PlatformView {
    return MRZScannerView(context!!, messenger, id)
}

}

Attention Context? context!!

From detail, you can see PlatformViewFactory source code:

public abstract PlatformView create(@Nullable Context context, int viewId, @Nullable Object args);

msalmancode commented 2 years ago

Class 'MRZScannerFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory

.pub-cache/hosted/pub.dartlang.org/flutter_mrz_scanner-2.0.0/android/src/main/kotlin/io/github/olexale/flutter_mrz_scanner/FlutterMrzScannerPlugin.kt: (30, 5): 'create' overrides nothing