kaderkita_ocr 0.1.0 copy "kaderkita_ocr: ^0.1.0" to clipboard
kaderkita_ocr: ^0.1.0 copied to clipboard

retracted

On-device Flutter OCR for Indonesian KTP and Kartu Keluarga (KK). Camera scanners with optional debug pipeline / ROI inspection.

kaderkita_ocr #

On-device Flutter OCR for Indonesian KTP and Kartu Keluarga (KK).

Scanners capture from the camera, run Google ML Kit Text Recognition locally, and return structured fields. Optional debug mode attaches raw OCR text, confidence, ROI/crop previews, and step-by-step pipeline images for tooling.

Privacy: all OCR runs on-device. No images or text are uploaded by this package.

Requirements #

Flutter >=3.38.0
Dart >=3.10.0
Platforms Android, iOS

Native pieces come from transitive plugins: camera, google_mlkit_text_recognition, and opencv_dart (KK frame stitching).

Install #

dependencies:
  kaderkita_ocr: ^0.1.0

Mirror the OpenCV module hooks in the host app pubspec.yaml (required for KK stitching):

hooks:
  user_defines:
    dartcv4:
      include_modules:
        - imgcodecs
        - imgproc
        - calib3d
        - features2d
        - flann
        - photo
        - stitching

Platform setup #

Android — camera permission in AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA"/>

iOS — camera usage string in Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera is used to scan KTP and Kartu Keluarga on-device.</string>

Quick start #

import 'package:kaderkita_ocr/kaderkita_ocr.dart';

Future<void> scanKtp(BuildContext context) async {
  final result = await Navigator.push<KtpScanResult>(
    context,
    MaterialPageRoute(
      builder: (_) => const KtpScanner(
        // debug: true → attach ScanDebug (raw text, ROIs, pipeline images)
        config: KaderkitaOcrConfig(debug: false),
      ),
    ),
  );
  if (result == null) return;
  print(result.data.nik);
  print(result.data.nama);
}

Same pattern for KK:

final result = await Navigator.push<KkScanResult>(
  context,
  MaterialPageRoute(builder: (_) => const KkScanner()),
);

Public API #

Type Role
KtpScanner / KkScanner Full-screen camera scanners; pop with a result
KaderkitaOcrConfig debug, autoCapture
KtpScanResult / KkScanResult data + optional debug
KtpData / KkData / KkMember Structured fields
ScanDebug / RoiPreview / ImagePipelineStep Debug payload
ScanDebugPanel / ImagePipelineViewer Optional debug UI widgets
NikValidator Structural NIK checks

Internals (OcrService, stitchers, parsers, Monte Carlo tools) live under lib/src/ and are not part of the stable public API.

Debug mode #

const KaderkitaOcrConfig(debug: true)

When enabled, result.debug includes:

  • rawText — OCR text dump
  • confidence — aggregate score when available
  • rois — bracket / column crop previews
  • pipelineSteps — labeled images for each preprocess / layout stage

Show them with ScanDebugPanel or ImagePipelineViewer.

When debug is false (default), heavy image bytes are not attached to the result.

Example #

See example/ for a minimal host app with a debug toggle and result pages.

cd example && flutter run

License #

Apache License 2.0 — see LICENSE.

1
likes
0
points
344
downloads

Publisher

unverified uploader

Weekly Downloads

On-device Flutter OCR for Indonesian KTP and Kartu Keluarga (KK). Camera scanners with optional debug pipeline / ROI inspection.

Repository (GitHub)
View/report issues

Topics

#ocr #ktp #kk #indonesia #mlkit

License

unknown (license)

Dependencies

camera, flutter, google_mlkit_text_recognition, image, opencv_dart, path, path_provider, permission_handler, shared_preferences, wakelock_plus

More

Packages that depend on kaderkita_ocr