id_card_ocr_web 2.1.0 copy "id_card_ocr_web: ^2.1.0" to clipboard
id_card_ocr_web: ^2.1.0 copied to clipboard

Platformweb

A client-side OCR package for Flutter Web using Tesseract.js.

1.0.0 #

  • Initial release of id_card_ocr_web.
  • Fully implemented pure client-side OCR extraction utilizing tesseract.js wrappers.
  • Wasm-compatible architectures via dart:js_interop (Dart 3.10+ fully compliant).
  • Built-in parsing mechanics for Indonesia (KTP - NIK, Name, Birthplace, Birth Date), Malaysia (Still on Progress).
  • Isolated text enhancement heuristics (BaseOcrEnhancer, NameOcrEnhancer, PlaceOcrEnhancer).

1.1.0 #

  • Improve Performance
  • Update latest web version
  • Bug Fixes

1.2.0 #

  • GPU-Accelerated Image Preprocessing:

    • Offloaded heavy image decoding, scaling, and character optimizations from the single-threaded Dart CPU layer into a high-speed HTML5 Canvas pipeline.
    • Implemented an adaptive luminosity thresholding algorithm (gray < 140) to completely eliminate blue KTP background grid lines and lighting distortions.
    • Swapped internal compression engines to lossless PNG encoding to maintain razor-sharp text boundaries on mobile device screen targets.
  • Memory-Safe Mobile WebView Interop:

    • Migrated from heavy, memory-intensive Base64 string payload transfers to lightweight browser Blob Object URL pointers.
    • Resolved runtime crashes and background thread terminations inside strict iOS WebViews (WKWebView) and Android Chromium sandboxes.
  • Robust Lifecycle Async Loading:

    • Replaced unstable inline script injection flags with a managed asynchronous Completer engine loop.
    • Added active global window namespace checks ('Tesseract' in window) to completely eliminate race conditions during high-volume scanning workloads.

2.0.0 #

  • Configurable Worker Hosting for WebView Compatibility:

    • Added an optional workerPath parameter to processKtp, letting the Tesseract worker script be served from your own origin instead of the CDN.
    • Resolves silent empty-result failures in strict WebViews (iOS WKWebView, CSP-restricted Android Chromium) that block cross-origin or blob-based Web Workers.
    • When workerPath is supplied, blob-URL workers are disabled (workerBlobURL: false) for clean same-origin worker loading; default CDN behavior is unchanged when the parameter is omitted.
  • Explicit Worker Lifecycle Management:

    • Migrated OCR execution from the one-shot Tesseract.recognize call to a managed createWorkerrecognizeterminate flow.
    • Enables per-call worker configuration and deterministic memory cleanup, reducing memory pressure during repeated scans inside mobile WebViews.
  • CSP-Safe Engine Detection:

    • Replaced the eval-based 'Tesseract' in window check with a direct global namespace lookup (window.has('Tesseract')).
    • Initialization no longer throws under Content Security Policies that disallow unsafe-eval.
  • Bug Fixes:

    • Fixed a type 'Null' is not a subtype of type 'Object' runtime crash caused by the worker terminate() promise resolving to undefined against a non-nullable interop type.

2.1.0 #

  • Full Self-Hosting Support (all assets, not just the worker):

    • Added optional corePath and langPath parameters to processKtp, and an optional scriptSrc parameter to initialize / processKtp.
    • Combined with the existing workerPath, all four Tesseract assets — the main script (tesseract.min.js), the worker (worker.min.js), the core WASM (tesseract.js-core), and the language data ({countryid}.traineddata.gz) — can now be served from your own origin.
    • Each path is independent: any parameter left unset falls back to the CDN, so callers can self-host all assets or only the ones they need.
  • Fixes Cross-Origin Asset Blocking on Mobile / iOS:

    • Resolves silent empty-result failures on iOS Safari / WKWebView (and other restricted environments) where cross-origin requests to the CDN — most often the core WASM (tesseract-core-*.wasm.js) — were blocked.
    • Self-hosting corePath and langPath makes those requests same-origin, which is the minimum needed to unblock affected devices; self-hosting all four removes every external CDN dependency.
  • Documentation:

    • Expanded the "Using inside a WebView or on mobile" guide: same-origin hosting layout, base-href path resolution, required .wasm Content-Type: application/wasm, keeping ind.traineddata.gz gzipped, avoiding auth-gated asset paths, and CSP guidance.
    • Added a note that OCR output is a draft for human review.
1
likes
150
points
245
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A client-side OCR package for Flutter Web using Tesseract.js.

Repository (GitHub)

License

MIT (license)

Dependencies

flutter, image, web

More

Packages that depend on id_card_ocr_web