2026-06-21 03:51:54 +08:00
|
|
|
import 'dart:typed_data';
|
2026-06-21 03:18:00 +08:00
|
|
|
|
2026-06-21 03:51:54 +08:00
|
|
|
import 'ocr/ocr_backends.dart';
|
2026-06-21 03:18:00 +08:00
|
|
|
|
2026-06-21 03:51:54 +08:00
|
|
|
/// Local OCR entry point. Delegates to a pluggable backend (embedded ONNX
|
|
|
|
|
/// recognition when a model is bundled, otherwise the native platform OCR).
|
|
|
|
|
///
|
|
|
|
|
/// The static API is kept for back-compat with [OcrService].
|
2026-06-21 03:18:00 +08:00
|
|
|
class OcrEngine {
|
|
|
|
|
/// Recognize text from a PNG image. Returns null when unavailable or empty.
|
2026-06-21 03:51:54 +08:00
|
|
|
static Future<String?> recognizeImage(Uint8List pngBytes) {
|
|
|
|
|
return OcrBackends.recognize(pngBytes);
|
2026-06-21 03:18:00 +08:00
|
|
|
}
|
|
|
|
|
}
|