detect method
Future<Payload?>
detect(
- dynamic detectable,
- List<
BarcodeFormats> ? formats, - bool? tryharder,
- bool? invert,
override
Implementation
@override
Future<Payload?> detect(dynamic detectable,
List<BarcodeFormats>? formats,
bool? tryharder, bool? invert) async {
if (detectable == null) return null;
if (detectable.image is! mlkit.InputImage) return null;
try {
// get barcode formats
var fmts = _getBarcodeFormats(formats);
// build detector
_detector ??= mlkit.BarcodeScanner(formats: fmts);
// process
Log().debug("Processing image ${++count}");
var barcodes = await _detector!.processImage(detectable.image);
// detect
return _buildPayload(barcodes);
}
catch (e) {
Log().exception(e);
return null;
}
}