part of 'zxing.dart'; IsolateUtils? isolateUtils; /// Starts reading barcode from the camera Future startCameraProcessing() async { isolateUtils = IsolateUtils(); await isolateUtils?.startReadingBarcode(); } /// Stops reading barcode from the camera void stopCameraProcessing() => isolateUtils?.stopReadingBarcode(); Future processCameraImage( CameraImage image, { int format = Format.Any, double cropPercent = 0.5, bool tryHarder = false, bool tryInverted = false, }) async { final IsolateData isolateData = IsolateData(image, format, cropPercent, tryHarder, tryInverted); final CodeResult result = await _inference(isolateData); return result; } /// Runs inference in another isolate Future _inference(IsolateData isolateData) async { final ReceivePort responsePort = ReceivePort(); isolateUtils?.sendPort ?.send(isolateData..responsePort = responsePort.sendPort); final dynamic results = await responsePort.first; return results; }