programmer443 / ocr_scanner

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.

Repository from Github https://github.comprogrammer443/ocr_scannerRepository from Github https://github.comprogrammer443/ocr_scanner

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';

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

βš™οΈ Configuration

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

πŸ“Έ 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.

License:Other


Languages

Language:Dart 38.1%Language:C++ 29.3%Language:CMake 23.6%Language:Ruby 3.3%Language:Swift 2.3%Language:C 1.7%Language:HTML 1.5%Language:Kotlin 0.2%Language:Objective-C 0.0%