Skip to content

Repository files navigation

Number Plate Scanner

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.


✨ Features

  • 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

🚀 Getting Started

1. Add Dependency

In your pubspec.yaml:

dependencies:
number_plate_scanner: ^0.1.0

Then run:

flutter pub get

2. iOS Setup

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'

🧑‍💻 Usage

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');
},
),
)

Example: Full App

import'package:flutter/material.dart';
import'package:number_plate_scanner/number_plate_scanner.dart';
voidmain() =>runApp(constMyApp());
classMyAppextendsStatelessWidget {
constMyApp({super.key});
@overrideWidgetbuild(BuildContext context) =>MaterialApp(
home:Scaffold(
body:NumberPlateScanner(
config:PlateScannerConfig(
ocrMode:OcrMode.plate,
enableGallery:true,
onPlateDetected: (result) {
// Handle detected text
},
),
),
),
);
}

⚙️ Configuration

OptionTypeDefaultDescription
ocrModeOcrModeOcrMode.plateOCR mode: plate, vin, document, custom
customRegexString?nullCustom regex for custom mode
enableGalleryboolfalseEnable image picker from gallery
onPlateDetectedFunction(String result)nullCallback when text is detected

📸 Screenshots

Number Plate Scanner Screenshot


🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page or submit a pull request.


📄 License

MIT

About

A full-featured Flutter OCR module for real-time number plate, VIN, document, and custom text recognition using Google ML Kit. Includes a modern UI, glassmorphic design, and supports Android & iOS.

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages