processCameraImage method
Reads barcode from the camera
Implementation
@override
Future<Code> processCameraImage(
CameraImage image,
DecodeParams params,
) async {
// The isolate picks single vs. multi decoding from `params.isMultiScan`, so
// force it to match the method that was called instead of returning a
// `Codes` that would fail an unrelated cast at the call site.
final Object? result = await zxingProcessCameraImage(
image,
params.isMultiScan ? params.copyWith(isMultiScan: false) : params,
);
if (result is! Code) {
throw StateError('Expected a Code from the decoder, got $result');
}
result.source = CodeSource.camera;
return result;
}