Skip to content

Commit

Permalink
fix for 3.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Magomed Dadagov committed Nov 2, 2022
1 parent bc9aa94 commit 81fc68d
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ import io.fotoapparat.selector.front

class FlutterMrzScannerPlugin : FlutterPlugin {

override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
flutterPluginBinding.platformViewRegistry.registerViewFactory("mrzscanner", MRZScannerFactory(flutterPluginBinding.binaryMessenger))
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
flutterPluginBinding.applicationContext
flutterPluginBinding.platformViewRegistry.registerViewFactory("mrzscanner", MRZScannerFactory(flutterPluginBinding))
}

override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {}
}

class MRZScannerFactory(private val messenger: BinaryMessenger) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
class MRZScannerFactory(private val flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(context: Context?, id: Int, o: Any?): PlatformView {

override fun create(context: Context, id: Int, o: Any?): PlatformView {
return MRZScannerView(context, messenger, id)
val ctx = if (context != null) context else flutterPluginBinding.applicationContext;

return MRZScannerView(ctx, flutterPluginBinding.binaryMessenger, id)
}
}

Expand Down

0 comments on commit 81fc68d

Please sign in to comment.