A modern, full-screen Flutter package for real-time number plate, VIN, and document OCR using Google ML Kit Text Recognition. Features a beautiful, glassmorphic UI, customizable OCR modes, and easy integration.
- Full-screen camera preview with modern UI
- Glassmorphic controls for capture and gallery
- OCR mode dropdown (Number Plate, VIN, Document, Custom Regex)
- Custom regex support for advanced use cases
- Beautiful overlays and error toasts
- Easy integration and extensibility
- Android & iOS support
In your pubspec.yaml:
dependencies: number_plate_scanner: ^0.1.0
Then run:
flutter pub get
Update your Info.plist for camera and gallery permissions:
Open ios/Runner/Info.plist and add:
<key>NSCameraUsageDescription</key> <string>This app needs camera access to scan number plates.</string> <key>NSPhotoLibraryUsageDescription</key> <string>This app needs photo library access to pick images for number plate scanning.</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>This app needs photo library access to save captured images.</string>
Set your minimum iOS deployment target to 15.5 or higher in your ios/Podfile:
platform :ios, '15.5'
import 'package:number_plate_scanner/number_plate_scanner.dart'; NumberPlateScanner( config: PlateScannerConfig( ocrMode: OcrMode.plate, // or .vin, .document, .custom customRegex: r'\d{4}-[A-Z]{2}', // for custom mode enableGallery: true, onPlateDetected: (result) { print('OCR result: $result'); }, ), )
import 'package:flutter/material.dart'; import 'package:number_plate_scanner/number_plate_scanner.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => MaterialApp( home: Scaffold( body: NumberPlateScanner( config: PlateScannerConfig( ocrMode: OcrMode.plate, enableGallery: true, onPlateDetected: (result) { // Handle detected text }, ), ), ), ); }
| Option | Type | Default | Description |
|---|---|---|---|
| ocrMode | OcrMode | OcrMode.plate | OCR mode: plate, vin, document, custom |
| customRegex | String? | null | Custom regex for custom mode |
| enableGallery | bool | false | Enable image picker from gallery |
| onPlateDetected | Function(String result) | null | Callback when text is detected |
Number Plate Scanner Screenshot
Contributions, issues and feature requests are welcome!
Feel free to check issues page or submit a pull request.