detect method
Implementation
@override
void detect(DetectableImage image, bool streamed) async {
if (!busy) {
busy = true;
count++;
// get the detector
var detector = await BarcodeDetector().getDetector();
// detect in image
var payload = await detector.detect(image, barcodeFormats, tryharder, invert);
if (payload != null) {
Data data = Payload.toData(payload);
await onDetected(data);
} else if (!streamed) {
await onDetectionFailed(Data(data: [
{
"message":
"Barcode detector $id failed to detect any barcodes in the supplied image"
}
]));
}
busy = false;
}
}