Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

advanced_business_card_reader

Business/visiting card reader plugin for Flutter.

  • Native OCR with Google ML Kit Text Recognition v2 on Android
  • Native OCR with Apple Vision on iOS, including arm64 simulator builds
  • Native entity extraction for extra phone/email/url signals
  • Dart-side fallback parsing for name/company/phones/emails/websites

What changed

This plugin now uses direct native platform APIs through a Flutter MethodChannel:

  • Channel: advanced_business_card_reader
  • Methods:
    • ocrFromFile
    • extractEntities

The public Dart API remains the same:

  • BusinessCardReader.scanFromFile(...)
  • BusinessCardReader.scanAutoFromFile(...)
  • BusinessCardScanResult / BusinessCardData
  • OcrScript values (latin, devanagari, chinese, japanese, korean)

Additive API for double-side cards:

  • BusinessCardReader.scanFromFilesFrontBack(...)
  • BusinessCardReader.scanAutoFromFilesFrontBack(...)
  • BusinessCardSidesResult (front, back, merged)

Install

dependencies:
  advanced_business_card_reader: ^1.1.2

Platform requirements

Android

  • Minimum SDK: 26 (required because of ML Kit Entity Extraction)
  • ML Kit dependencies are provided by the plugin:
    • com.google.mlkit:text-recognition:16.0.1
    • com.google.mlkit:text-recognition-devanagari:16.0.1
    • com.google.mlkit:text-recognition-chinese:16.0.1
    • com.google.mlkit:text-recognition-japanese:16.0.1
    • com.google.mlkit:text-recognition-korean:16.0.1
    • com.google.mlkit:entity-extraction:16.0.0-beta6

If you want a smaller binary, you can fork and remove script-specific recognizers you do not need.

iOS

  • iOS deployment target: 15.5
  • Supports arm64 iOS device and arm64 iOS simulator builds, including iOS 26+ simulator runtimes
  • Uses Apple system frameworks: Vision for OCR and Foundation/NSDataDetector for entity hints
  • No Google ML Kit pods are used on iOS, and no simulator architecture exclusions are set by this plugin

Entity Extraction models are downloaded on-device with downloadModelIfNeeded() before annotation on Android. iOS entity hints use NSDataDetector and do not require model downloads.

Upgrading iOS projects from 1.1.1

Version 1.1.2 removes all iOS Google ML Kit pods from this plugin. If your app still reports GoogleMLKit, MLImage, MLKitCommon, MLKitEntityExtraction, or MLKitVision as transitive dependencies of advanced_business_card_reader, clean the old CocoaPods lock state after updating the package:

flutter clean
flutter pub get
cd ios
rm -rf Pods Podfile.lock
pod install --repo-update
cd ..
flutter run

Usage

import 'package:advanced_business_card_reader/advanced_business_card_reader.dart';

final result = await BusinessCardReader.scanFromFile(
  filePath,
  script: OcrScript.latin,
  defaultIsoCountry: 'IN',
);

print(result.data.name);
print(result.data.company);
print(result.data.phones);
print(result.data.emails);
print(result.data.websites);
print(result.data.rawText);

Auto script:

final result = await BusinessCardReader.scanAutoFromFile(
  filePath,
  preferredScripts: const [
    OcrScript.latin,
    OcrScript.devanagari,
    OcrScript.chinese,
    OcrScript.japanese,
    OcrScript.korean,
  ],
  defaultIsoCountry: 'IN',
);

Double-side card:

final sides = await BusinessCardReader.scanAutoFromFilesFrontBack(
  frontPath: frontImagePath,
  backPath: backImagePath,
  preferredScripts: const [
    OcrScript.latin,
    OcrScript.devanagari,
    OcrScript.chinese,
    OcrScript.japanese,
    OcrScript.korean,
  ],
  defaultIsoCountry: 'IN',
);

print('Front: ${sides.front.data.toJson()}');
print('Back: ${sides.back.data.toJson()}');
print('Merged: ${sides.merged.data.toJson()}');

Parsing behavior

  • OCR text is always parsed by regex + phone_numbers_parser fallback.
  • Entity extraction is best-effort enhancement only.
  • phones, emails, and websites are merged as a union of:
    • parser results
    • extracted entities
  • If entity extraction fails or a model download fails, parser fallback output is still returned.

Unsupported platforms

Web/desktop are not supported. Calls throw UnsupportedError with a clear message.

Example app

The example app includes:

  • Camera
  • Gallery
  • File picker
  • Script selector (Auto + individual scripts)
  • Single-side and double-side scan modes

Run:

cd example
flutter run

License

MIT

About

Business/visiting card reader using Google ML Kit Text Recognition (Flutter). Extracts text and parses name, company, phone, email, website.

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Contributors

Languages