FakeCaptureService class

Deterministic OCR for tests + simulators: returns canned results, either a single fixed result or one built from raw lines. No native dependency.

Implemented types

Constructors

FakeCaptureService(OcrResult result, {List<String> barcodes = const [], DocumentRect? docRect})
const
FakeCaptureService.lines(List<String> lines, {List<String> barcodes = const [], DocumentRect? docRect})
Build a fake from raw lines of text.
factory

Properties

barcodes → List<String>
final
docRect → DocumentRect?
When non-null, detectDocumentRect returns this box; null models "no document detected" (the default).
final
hashCode → int
The hash code for this object.
no setterinherited
result → OcrResult
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

detectDocumentRect(Uint8List imageBytes) → Future<DocumentRect?>
Detect a document/card in the image and return its bounding box (to seed a confirm-crop UI), or null when none is found / the platform can't. A caller should let the user confirm or adjust the rectangle before any crop is applied — this is a hint, never an automatic crop. Default no-op for fakes.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recognize(Uint8List imageBytes) → Future<OcrResult>
override
recognizeBarcodes(Uint8List imageBytes) → Future<List<String>>
Decode 2D barcodes from the image — chiefly a driver license's PDF417 (its AAMVA payload, see Aamva.parse). Returns the raw payload strings, or [] when there are none / the platform can't. Default no-op so fakes need not implement it.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited