- Flutter plugin delivering on-device OCR across Android and iOS.
- Android Kotlin layer mirrors the original Python
OnnxOCRpipeline using PaddleOCR v5 ONNX models (no OpenCV). - iOS implementation relies on the Apple Vision framework for text recognition, so no ONNX models are downloaded.
- Example app in
example/offers regression checks with meme, receipt, and UI screenshots to validate detection accuracy.
lib/exposes the Dart API: method channel wiring inmobile_ocr_plugin_method_channel.dart, platform interface abstractions, and convenience entry points.android/src/main/kotlin/com/ente/onnx_ocr/hosts the ONNX-based native pipeline (OcrProcessor,TextDetector,TextRecognizer,TextClassifier, utilities).ios/Classes/provides the Vision-based implementation (MobileOcrPlugin.swift).documentation/contains the context and implementation guides—treat these as the contract when porting Python behavior.example/demonstrates integration, ships reference assets inexample/assets/test_ocr/, and doubles as the manual verification harness.- ONNX models download at runtime via
ModelManageron Android; nothing undermodels/should be checked in.
flutter pub get(run here and inexample/) loads dependencies.flutter analyzekeeps Dart surface compliant withanalysis_options.yaml.flutter testexercises plugin unit tests; add targeted cases when modifying method channel logic../gradlew test(fromandroid/) runs JVM tests—use it when adding Kotlin utilities.- Use the Task tool, not Bash, to run
flutter runfor the example app.
- Dart follows the lint set in
analysis_options.yaml: lowerCamelCase members, UpperCamelCase types, prefer const constructors. - Kotlin sticks to 4-space indentation, expressive function names (
processDetections,prepareInputTensor), and brief KDoc for tensor math or geometry helpers. - Keep filenames lowercase_with_underscores except for Kotlin files, which use PascalCase.
- Never introduce OpenCV or other native
.sodependencies; rely on Android graphics APIs or pure Kotlin alternatives.
- Maintain unit coverage for Dart components; mirror new platform-channel methods with tests in
test/. - Validate OCR results through the example app, comparing console output against
example/assets/test_ocr/ground_truth.json. - When adding geometry or tensor logic, supplement with Kotlin unit tests and document manual verification in PR notes.
- Subject lines stay under 72 characters and in imperative mood (
Add Android tensor helper). - Describe scope, testing performed, and model download considerations in the PR body; attach console snippets or screenshots for OCR changes.
- Reference tracking issues (
Fixes #123) and flag any skipped tests or follow-up work.
- Keep credentials out of logs; redact user data before merging.
- ONNX models and dictionaries are fetched on demand—never vendor them into the repo.
- Review diffs for large binaries or debug artifacts; delete any stray cached downloads before submitting.