https://github.com/yushulx/flutter_ocr_sdk
Detect machine-readable zones (MRZ) in passports, travel documents, and ID cards
https://github.com/yushulx/flutter_ocr_sdk
dart flutter idcard mrz mrz-scanner ocr passport vin vin-scanner visa
Last synced: 3 months ago
JSON representation
Detect machine-readable zones (MRZ) in passports, travel documents, and ID cards
- Host: GitHub
- URL: https://github.com/yushulx/flutter_ocr_sdk
- Owner: yushulx
- License: mit
- Created: 2021-07-21T08:33:51.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-16T03:09:23.000Z (5 months ago)
- Last Synced: 2025-05-16T03:22:50.789Z (5 months ago)
- Topics: dart, flutter, idcard, mrz, mrz-scanner, ocr, passport, vin, vin-scanner, visa
- Language: C++
- Homepage: https://pub.dev/packages/flutter_ocr_sdk
- Size: 127 MB
- Stars: 15
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter MRZ/VIN SDK
A Flutter wrapper for the **Dynamsoft Capture Vision SDK**, featuring built-in **MRZ (Machine Readable Zone)** and **VIN (Vehicle Identification Number)** detection models.

## Demo Video
- **Android**
https://github.com/user-attachments/assets/7e84b0c8-c492-4262-97c7-851651d9327e
- **iOS**
https://github.com/user-attachments/assets/56ddd2a7-7ef9-4376-a090-2b562801c660
- **Web**
https://github.com/user-attachments/assets/df02a1e7-a751-4048-9ed0-b9df6ee27621
- **Windows**
https://github.com/user-attachments/assets/b3e9f541-1747-413f-98f5-2291be35bd71
- **Linux**
https://github.com/user-attachments/assets/7a8748a4-dcc7-4889-9043-805d1a6aba62
## Supported Platforms
- ✅ Windows
- ✅ Linux
- ✅ Android
- ✅ iOS
- Add camera and microphone usage descriptions to `ios/Runner/Info.plist`:
```xml
NSCameraUsageDescription
Can I use the camera please?
NSMicrophoneUsageDescription
Can I use the mic please?
```
- Minimum deployment target: iOS 13.0 or later- ✅ Web
In `index.html`, include:```html
```## Prerequisites
- A valid [Dynamsoft Capture Vision license key](https://www.dynamsoft.com/customer/license/trialLicense/?product=dcv&package=cross-platform)## Getting Started
1. Set the license key in `example/lib/global.dart`:```dart
Future initSDK() async {
int? ret = await detector.init(
"LICENSE-KEY");
...
}
```
2. Run the example project on your desired platform:```bash
cd example
flutter run -d chrome # Run on Web
flutter run -d linux # Run on Linux
flutter run -d windows # Run on Windows
flutter run # Run on default connected device (e.g., Android)
```## API Reference
| Method | Description | Parameters | Return Type |
|------------------------------------------------------------------------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `Future init(String key)` | Initializes the OCR SDK with a license key. | `key`: License string | `Future` |
| `Future>?> recognizeBuffer(Uint8List bytes, int width, int height, int stride, int format, int rotation)` | Performs OCR on a raw image buffer. | `bytes`: RGBA image buffer
`width`, `height`: Image dimensions
`stride`: Row bytes
`format`: Pixel format index
`rotation`: 0/90/180/270 | `Future>?>` |
| `Future>?> recognizeFile(String filename)` | Performs OCR on an image file. | `filename`: Path to the image file | `Future>?>` |
| `Future loadModel({ModelType modelType = ModelType.mrz})` | Loads the OCR model by type (`mrz` or `vin`). | `modelType`: Optional, defaults to `ModelType.mrz` | `Future` |