Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
flutterbarcode-generatorbarcode-scannergeneratorqrqrcodeqrcode-generatorqrcode-scannerscannerzxingbarcodezxscanner
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
906 B
30 lines
906 B
part of 'zxing.dart'; |
|
|
|
IsolateUtils? isolateUtils; |
|
|
|
/// Starts reading barcode from the camera |
|
Future<void> zxingStartCameraProcessing() async { |
|
isolateUtils = IsolateUtils(); |
|
await isolateUtils?.startReadingBarcode(); |
|
} |
|
|
|
/// Stops reading barcode from the camera |
|
void zxingStopCameraProcessing() => isolateUtils?.stopReadingBarcode(); |
|
|
|
Future<dynamic> zxingProcessCameraImage( |
|
CameraImage image, { |
|
DecodeParams? params, |
|
}) async { |
|
final IsolateData isolateData = IsolateData(image, params ?? DecodeParams()); |
|
final dynamic result = await _inference(isolateData); |
|
return result; |
|
} |
|
|
|
/// Runs inference in another isolate |
|
Future<dynamic> _inference(IsolateData isolateData) async { |
|
final ReceivePort responsePort = ReceivePort(); |
|
isolateUtils?.sendPort |
|
?.send(isolateData..responsePort = responsePort.sendPort); |
|
final dynamic results = await responsePort.first; |
|
return results; |
|
}
|
|
|