id_card_ocr_web 2.1.0
id_card_ocr_web: ^2.1.0 copied to clipboard
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.jswrappers. - 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
Completerengine loop. - Added active global window namespace checks (
'Tesseract' in window) to completely eliminate race conditions during high-volume scanning workloads.
- Replaced unstable inline script injection flags with a managed asynchronous
2.0.0 #
-
Configurable Worker Hosting for WebView Compatibility:
- Added an optional
workerPathparameter toprocessKtp, 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
workerPathis supplied, blob-URL workers are disabled (workerBlobURL: false) for clean same-origin worker loading; default CDN behavior is unchanged when the parameter is omitted.
- Added an optional
-
Explicit Worker Lifecycle Management:
- Migrated OCR execution from the one-shot
Tesseract.recognizecall to a managedcreateWorker→recognize→terminateflow. - Enables per-call worker configuration and deterministic memory cleanup, reducing memory pressure during repeated scans inside mobile WebViews.
- Migrated OCR execution from the one-shot
-
CSP-Safe Engine Detection:
- Replaced the
eval-based'Tesseract' in windowcheck with a direct global namespace lookup (window.has('Tesseract')). - Initialization no longer throws under Content Security Policies that disallow
unsafe-eval.
- Replaced the
-
Bug Fixes:
- Fixed a
type 'Null' is not a subtype of type 'Object'runtime crash caused by the workerterminate()promise resolving toundefinedagainst a non-nullable interop type.
- Fixed a
2.1.0 #
-
Full Self-Hosting Support (all assets, not just the worker):
- Added optional
corePathandlangPathparameters toprocessKtp, and an optionalscriptSrcparameter toinitialize/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.
- Added optional
-
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
corePathandlangPathmakes those requests same-origin, which is the minimum needed to unblock affected devices; self-hosting all four removes every external CDN dependency.
- Resolves silent empty-result failures on iOS Safari /
-
Documentation:
- Expanded the "Using inside a WebView or on mobile" guide: same-origin hosting layout,
base-hrefpath resolution, required.wasmContent-Type: application/wasm, keepingind.traineddata.gzgzipped, avoiding auth-gated asset paths, and CSP guidance. - Added a note that OCR output is a draft for human review.
- Expanded the "Using inside a WebView or on mobile" guide: same-origin hosting layout,