mrz_scanner
bonaparta13/mrz_scanner open-source repository details.
- スター
- 6
- フォーク
- 19
- 最終プッシュ(UTC)
- 2026/03/13
- プロジェクト状態
- 公開中
元の README
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
MRZ Scanner
A lightweight Flutter plugin for scanning and parsing Machine Readable Zones (MRZ) from passports, ID cards, and visas. Supports both live camera scanning and image file parsing.
Supported Formats
| Format | Description | Lines |
|---|---|---|
| TD1 | ID Cards | 3 x 30 chars |
| TD2 | ID Cards | 2 x 36 chars |
| TD3 | Passports | 2 x 44 chars |
| MRVA | Visas | 2 x 44 chars |
| MRVB | Visas | 2 x 36 chars |
Platform Support
| Android | iOS | |
|---|---|---|
| Support | SDK 24+ | iOS 13+ |
Note: Camera scanning requires a real device, not an emulator.
Setup
Android
Add to AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
iOS
Add to Info.plist:
<key>NSCameraUsageDescription</key>
<string>Allow Camera to scan MRZ</string>
Usage
import 'package:mrz_scanner/mrz_scanner.dart';
Camera Scanning
Use the MRZScanner widget for live camera-based scanning:
MRZScanner(
onSuccess: (mrzResult, lines) {
print(mrzResult.documentNumber);
print(mrzResult.givenNames);
print(mrzResult.surnames);
print(mrzResult.birthDate);
print(mrzResult.expiryDate);
print(mrzResult.sex);
print(mrzResult.countryCode);
},
)
Options
| Parameter | Type | Default | Description |
|---|---|---|---|
onSuccess |
Function(MRZResult, List<String>) |
required | Callback with parsed result and raw MRZ lines |
initialDirection |
CameraLensDirection |
back |
Camera to use |
showOverlay |
bool |
true |
Show document frame overlay |
controller |
MRZController? |
null |
Controller for resetting scan state |
Resetting the Scanner
Use a controller to reset scanning after a successful read:
final controller = MRZController();
MRZScanner(
controller: controller,
onSuccess: (result, lines) {
// Process result, then allow scanning again
controller.currentState?.resetScanning();
},
)
Image File Scanning
Use MRZScanner.scanImage() to parse an MRZ from a file path (e.g. from gallery or file picker):
try {
final result = await MRZScanner.scanImage('/path/to/document.jpg');
print(result.documentNumber);
} on FormatException {
print('No valid MRZ found in image');
}
MRZResult Fields
| Field | Type | Description |
|---|---|---|
documentType |
String |
Document type (P, I, V, etc.) |
countryCode |
String |
Issuing country code |
surnames |
String |
Holder's surnames |
givenNames |
String |
Holder's given names |
documentNumber |
String |
Document number |
nationalityCountryCode |
String |
Nationality country code |
birthDate |
DateTime |
Date of birth |
sex |
Sex |
Sex.male, Sex.female, or Sex.none |
expiryDate |
DateTime |
Expiry date |
personalNumber |
String |
Personal/optional number |
Demo
License
mrz_scanner is released under a MIT License. See LICENSE for details.
使用している依存関係
依存関係一覧 6 件
- flutter
{"sdk":"flutter"} - camera
^0.12.0 - flutter_tesseract_ocr
^0.4.30 - path_provider
^2.1.5 - flutter_test開発用
{"sdk":"flutter"} - flutter_lints開発用
^2.0.0
プロジェクトに合うリポジトリを選ぶには?
用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
- 名前・作者・説明で検索し、技術トピックで絞り込みます。
- スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
- 利用前に GitHub で README、ライセンス、Issues を確認します。
情報源と管理
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗
