how i can scan ID Card(NIC) in flutter and also get data from it?

2.8k Views Asked by At

I am building an app in flutter and in that app one step is to scan an id card (NIC) and get their name, DOB, expiry date, etc, so I am confusing that how I can scan and get data. is any package in a flutter, which can help me.

2

There are 2 best solutions below

1
Niasesan On

U can use MLKIT to extract data from ID into input field

0
Boommeister On

This package does exactly what you want: https://pub.dev/packages/flutter_mrz_scanner

I implemented it today in my flutter app. First it didn't start with this error:

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

But after following this issue by replacing this it worked:

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)
}
}

(context!! instead of context?)

However, on my phone Xiaomi Mi9T takes very long until it works and the plugin recognizes my German ID, so it's almost unusable. But it's the only free plugin I found for scanning IDs. I'll try it with an iPhone and another ID in the next days, maybe that works better.