scannerpro 1.1.3 copy "scannerpro: ^1.1.3" to clipboard
scannerpro: ^1.1.3 copied to clipboard

Universal Flutter Scanner Pro SDK (francis2408/scanner_pro) with real-time REST API lookup, ML Kit vision AI, and multi-document parsing.

Universal Scanner Pro SDK (scannerpro) #

Scanner Pro Banner

Pub Version Pub Points GitHub Repository License: MIT Platform: Android | iOS



โšก Overview & Architecture #

Universal Scanner Pro (scannerpro) is an enterprise-grade, high-throughput Flutter SDK for real-time document parsing, ML Kit vision AI, and automated REST API lookups across 10 scanning modes.

Equipped with Google ML Kit Vision AI, mathematical checksum validators (Verhoeff D10, ICAO Doc 9303, ISO 3779), an in-memory sub-millisecond LRU cache (_lookupCache), and direct external REST API enrichments, Scanner Pro delivers instant document verification, custom reticle designs, and feature-flag access control.

๐Ÿ—๏ธ Architecture & Component Decoupling #

  • ScannerController: Manages camera lifecycle, flash/zoom controls, active scanner modes, and frame stream listeners.
  • ScannerCameraPreview: Unopinionated, raw camera viewport widget for full screen design customizability.
  • UniversalScanEngine: Streamlined ML Kit vision pipeline with zero-copy buffer allocations.
  • ExternalLookupService: Real-time REST API enrichment engine with sub-millisecond LRU memory cache (<0.1ms).
  • Standalone Parsers: Pure Dart mathematical parsers (AadhaarParser, PanCardParser, MrzPassportParser, DrivingLicenseParser, VinParser, Gs1BarcodeParser).

๐Ÿ“Š Benchmark & Performance Metrics #

Component / Parser Operation Latency Throughput Strategy / Optimization
ISO 3779 VIN Parser 11.6 ยตs / op ~86,200 ops/sec Static check digit matrix & compiled WMI manufacturer map
GS1 Barcode Parser 17.4 ยตs / op ~57,400 ops/sec Zero-copy AI code slicer & binary range matching
AAMVA DL PDF417 Parser 26.8 ยตs / op ~37,300 ops/sec Direct ANSI line-buffer scanner
Indian Aadhaar Card Parser 99.4 ยตs / op ~10,060 ops/sec Pre-compiled Verhoeff lookup matrix & XML node parser
Income Tax PAN Card Parser 106.2 ยตs / op ~9,410 ops/sec Fuzzy OCR character replacement & position rules
Passport MRZ Parser 166.8 ยตs / op ~6,000 ops/sec Dual-line ICAO 9303 7-3-1 modulo-10 checksum verifier
External API Lookup Cache < 0.1 ms Instant Cache Hit 250-item thread-safe LRU memory cache

๐ŸŽจ Custom Screen Design & Visual Themes #

Scanner UI Preview

Use ONLY the Functionality with Your Own Screen Design #

If you want to use ONLY the scanner functionality and create your own screen design, use ScannerController and ScannerCameraPreview:

import 'package:flutter/material.dart';
import 'package:scannerpro/scannerpro.dart';

class MyCustomScannerScreen extends StatefulWidget {
  const MyCustomScannerScreen({super.key});

  @override
  State<MyCustomScannerScreen> createState() => _MyCustomScannerScreenState();
}

class _MyCustomScannerScreenState extends State<MyCustomScannerScreen> {
  late ScannerController _controller;

  @override
  void initState() {
    super.initState();
    // 1. Instantiate standalone scanner controller
    _controller = ScannerController(
      initialMode: ScanMode.qr,
      onResultDetected: (result) => print('Scanned: ${result.rawValue}'),
    );
    _controller.initialize();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ListenableBuilder(
      listenable: _controller,
      builder: (context, _) {
        return Scaffold(
          body: Stack(
            children: [
              // 2. Unopinionated camera feed widget
              ScannerCameraPreview(controller: _controller),

              // 3. Your custom reticle overlay & screen design!
              Center(
                child: Container(
                  width: 260,
                  height: 260,
                  decoration: BoxDecoration(
                    border: Border.all(color: Colors.cyan, width: 3),
                    borderRadius: BorderRadius.circular(16),
                  ),
                ),
              ),

              // 4. Your custom buttons & controls
              Positioned(
                bottom: 30,
                left: 20,
                right: 20,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    IconButton(
                      icon: Icon(_controller.isFlashOn ? Icons.flash_on : Icons.flash_off),
                      onPressed: () => _controller.toggleFlash(),
                    ),
                    ElevatedButton(
                      onPressed: () => _controller.setMode(ScanMode.barcode),
                      child: const Text('Barcode Mode'),
                    ),
                    IconButton(
                      icon: const Icon(Icons.photo_library),
                      onPressed: () => _controller.pickAndScanImage(),
                    ),
                  ],
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}

Or use UniversalScannerView.builder(...) for total layout customization:

UniversalScannerView.builder(
  builder: (context, controller, cameraPreview) {
    return Scaffold(
      body: Stack(
        children: [
          cameraPreview, // Raw camera feed
          MyCustomFrameWidget(),
          MyCustomButtons(controller: controller),
        ],
      ),
    );
  },
);

Pre-packaged Visual Themes #

  • Built-in Presets: ScannerUiTheme.dark, ScannerUiTheme.cyan, ScannerUiTheme.emerald, ScannerUiTheme.amber.
  • Custom Color Overrides: Reticle corners, border outlines, laser beam colors, viewfinder mask opacity, and background containers.
  • Dimensional Controls: Custom reticle corner radii, stroke widths, bracket lengths, and element toggles.

๐ŸŒŸ Key Features #

๐Ÿ“„ 1. Multi-Document & Vision AI Engines (10 Scan Modes) #

Mode Target Document / Symbology Parsing & Validation Pipeline
Aadhaar Card Indian Aadhaar Secure QR & Front OCR Verhoeff D10 checksum + XML/OCR text extractor + India Post Pincode API
PAN Card Income Tax Permanent Account Number 10-char structural regex + Surname decoding + Fuzzy OCR space/letter repair
Passport MRZ Passports & ICAO Doc 9303 MRZ Lines 2-line & 3-line MRZ parser + 7-3-1 weight check digits + Country metadata
Driving License AAMVA PDF417 Barcode & State DL OCR AAMVA 3-character field decoding + Expiration & issue date extractors
Vehicle VIN 17-character ISO 3779 Vehicle Number Transposition check digit + WMI manufacturer decode + Live NHTSA API
1D Barcode EAN-13, EAN-8, UPC-A, Code39, Code128 Retail barcode parser + Open Food Facts & UPC Item DB REST lookups
QR Code URLs, WiFi, VCard, Geo, UPI QR UPI payment extractor (VPA, GPay/PhonePe, SBI, MCC) + Web metadata API
PDF417 Stacked 2D Barcodes High-density ID card & boarding pass parsing
Text OCR Print & Handwriting Recognition General on-device text block & line extraction
Face AI Face Landmark & Pose Detection Eye landmark mesh circles + Face oval reticle guide

๐Ÿ›ก๏ธ 2. Selective Access Control (Feature Flags) #

Selectively enable or restrict scanner modes based on feature flags or explicit mode lists:

// Enable only Aadhaar and PAN Card scanning
UniversalScannerView(
  enableAadhaar: true,
  enablePan: true,
  enablePassport: false,
  enableDrivingLicense: false,
  enableQr: false,
)

โšก 3. Binary Size & Performance Optimization #

  • Unbundled Google Play Services ML Models: Downloads vision models on demand via Google Play Services (com.google.mlkit.vision.DEPENDENCIES), saving ~25โ€“35 MB in APK download size.
  • R8 Bytecode & Resource Shrinking: Automated bytecode minification and resource stripping via ProGuard optimization rules.
  • Zero Unused Dependencies: Streamlined transitive dependencies for minimal package footprint.

๐Ÿš€ Getting Started #

Installation #

Add scannerpro to your pubspec.yaml:

dependencies:
  scannerpro: ^1.1.3

Run flutter pub get.


๐Ÿ’ป Usage Examples #

1. Simple Scanner Widget #

import 'package:flutter/material.dart';
import 'package:scannerpro/scannerpro.dart';

class MyScannerScreen extends StatelessWidget {
  const MyScannerScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: UniversalScannerView(
        initialMode: ScanMode.qr,
        onResultDetected: (ScanResult result) {
          debugPrint('Scanned Mode: ${result.mode.title}');
          debugPrint('Parsed Data: ${result.fields}');
          debugPrint('Validity: ${result.isValid}');
        },
      ),
    );
  }
}

2. Custom UI Design & Theme Presets #

UniversalScannerView(
  // Use preset theme:
  theme: ScannerUiTheme.emerald,

  // Or override individual design parameters:
  primaryAccentColor: const Color(0xFFFF0055), // Custom Neon Pink
  backgroundColor: const Color(0xFF10141D),
  overlayMaskColor: Colors.black.withOpacity(0.75),
  laserBeamColor: const Color(0xFFFFD600),
  showModeBadge: true,
  showGuideBox: true,
  showLaserBeam: true,
)

3. Feature-Flagged Document Access Control #

UniversalScannerView(
  initialMode: ScanMode.aadhaar,
  enableAadhaar: true,
  enablePan: true,
  enablePassport: true,
  enableDrivingLicense: false,
  enableQr: false,
  enableBarcode: false,
)

4. Direct Standalone Parser APIs #

You can also use standalone mathematical parsers directly without opening the camera view:

import 'package:scannerpro/scannerpro.dart';

// Parse Indian Aadhaar Card QR/OCR text:
final aadhaarResult = AadhaarParser.parse(rawTextOrXml);
print('UID Checksum Valid: ${aadhaarResult.isValid}');

// Parse Income Tax PAN Card text:
final panResult = PanCardParser.parse('ABCPE1234F');
print('Taxpayer Category: ${panResult.fields['Taxpayer Category']}');

// Parse Passport MRZ string:
final passportResult = MrzPassportParser.parse(mrzLines);
print('Passport Number: ${passportResult.fields['Passport Number']}');

๐Ÿ”ง Platform Setup #

Android Setup (android/app/src/main/AndroidManifest.xml) #

Add camera permissions and the unbundled ML Kit vision model downloader:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application ...>
        <!-- Unbundled ML Kit vision models (Saves ~30 MB APK size) -->
        <meta-data
            android:name="com.google.mlkit.vision.DEPENDENCIES"
            android:value="barcode,ocr,face" />
    </application>
</manifest>

iOS Setup (ios/Runner/Info.plist) #

Add the camera usage permission string:

<key>NSCameraUsageDescription</key>
<string>This app requires camera access to scan documents, QR codes, and barcodes.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to select document images for scanning.</string>

๐Ÿ“„ License #

This project is licensed under the OSI-Approved MIT License.

1
likes
0
points
1.07k
downloads

Publisher

unverified uploader

Weekly Downloads

Universal Flutter Scanner Pro SDK (francis2408/scanner_pro) with real-time REST API lookup, ML Kit vision AI, and multi-document parsing.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

camera, flutter, google_mlkit_commons, image_picker, intl

More

Packages that depend on scannerpro