mrz_scanner 0.0.1+3 mrz_scanner: ^0.0.1+3 copied to clipboard
A package that allows you to Scan any kind of documents that have any mrz format
import 'package:flutter/material.dart';
import 'package:mrz_scanner/mrz_scanner.dart';
Future<void> main() async {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final MRZController controller = MRZController();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(builder: (context) {
return MRZScanner(
controller: controller,
onSuccess: (mrzResult) async {
await showDialog(
context: context,
builder: (context) => Dialog(
insetPadding: const EdgeInsets.symmetric(horizontal: 10),
child: SingleChildScrollView(
padding: const EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
controller.currentState?.resetScanning();
},
child: const Text('Reset Scanning'),
),
Text('Name : ${mrzResult.givenNames}'),
Text('Gender : ${mrzResult.sex.name}'),
Text('CountryCode : ${mrzResult.countryCode}'),
Text('Date of Birth : ${mrzResult.birthDate}'),
Text('Expiry Date : ${mrzResult.expiryDate}'),
Text('DocNum : ${mrzResult.documentNumber}'),
],
),
),
),
);
},
);
}),
);
}
}