Showing
5 changed files
with
10 additions
and
6 deletions
| @@ -94,7 +94,8 @@ class MobileScannerWebPlugin { | @@ -94,7 +94,8 @@ class MobileScannerWebPlugin { | ||
| 94 | cameraFacing: cameraFacing, | 94 | cameraFacing: cameraFacing, |
| 95 | ); | 95 | ); |
| 96 | 96 | ||
| 97 | - _barCodeStreamSubscription = barCodeReader.detectBarcodeContinuously().listen((code) { | 97 | + _barCodeStreamSubscription = |
| 98 | + barCodeReader.detectBarcodeContinuously().listen((code) { | ||
| 98 | if (code != null) { | 99 | if (code != null) { |
| 99 | controller.add({ | 100 | controller.add({ |
| 100 | 'name': 'barcodeWeb', | 101 | 'name': 'barcodeWeb', |
| @@ -20,7 +20,6 @@ class Code { | @@ -20,7 +20,6 @@ class Code { | ||
| 20 | external Uint8ClampedList get binaryData; | 20 | external Uint8ClampedList get binaryData; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | - | ||
| 24 | class JsQrCodeReader extends WebBarcodeReaderBase | 23 | class JsQrCodeReader extends WebBarcodeReaderBase |
| 25 | with InternalStreamCreation, InternalTorchDetection { | 24 | with InternalStreamCreation, InternalTorchDetection { |
| 26 | JsQrCodeReader({required super.videoContainer}); | 25 | JsQrCodeReader({required super.videoContainer}); |
| @@ -78,7 +77,8 @@ class JsQrCodeReader extends WebBarcodeReaderBase | @@ -78,7 +77,8 @@ class JsQrCodeReader extends WebBarcodeReaderBase | ||
| 78 | /// Captures a frame and analyzes it for QR codes | 77 | /// Captures a frame and analyzes it for QR codes |
| 79 | Future<Code?> _captureFrame(VideoElement video) async { | 78 | Future<Code?> _captureFrame(VideoElement video) async { |
| 80 | if (localMediaStream == null) return null; | 79 | if (localMediaStream == null) return null; |
| 81 | - final canvas = CanvasElement(width: video.videoWidth, height: video.videoHeight); | 80 | + final canvas = |
| 81 | + CanvasElement(width: video.videoWidth, height: video.videoHeight); | ||
| 82 | final ctx = canvas.context2D; | 82 | final ctx = canvas.context2D; |
| 83 | 83 | ||
| 84 | ctx.drawImage(video, 0, 0); | 84 | ctx.drawImage(video, 0, 0); |
| @@ -26,8 +26,10 @@ class JsZXingBrowserMultiFormatReader { | @@ -26,8 +26,10 @@ class JsZXingBrowserMultiFormatReader { | ||
| 26 | abstract class Result { | 26 | abstract class Result { |
| 27 | /// raw text encoded by the barcode | 27 | /// raw text encoded by the barcode |
| 28 | external String get text; | 28 | external String get text; |
| 29 | + | ||
| 29 | /// Returns raw bytes encoded by the barcode, if applicable, otherwise null | 30 | /// Returns raw bytes encoded by the barcode, if applicable, otherwise null |
| 30 | external Uint8ClampedList? get rawBytes; | 31 | external Uint8ClampedList? get rawBytes; |
| 32 | + | ||
| 31 | /// Representing the format of the barcode that was decoded | 33 | /// Representing the format of the barcode that was decoded |
| 32 | external int? format; | 34 | external int? format; |
| 33 | } | 35 | } |
| @@ -87,7 +89,10 @@ abstract class Exception { | @@ -87,7 +89,10 @@ abstract class Exception { | ||
| 87 | external String get message; | 89 | external String get message; |
| 88 | } | 90 | } |
| 89 | 91 | ||
| 90 | -typedef BarcodeDetectionCallback = void Function(Result? result, Exception? error); | 92 | +typedef BarcodeDetectionCallback = void Function( |
| 93 | + Result? result, | ||
| 94 | + Exception? error, | ||
| 95 | +); | ||
| 91 | 96 | ||
| 92 | extension JsZXingBrowserMultiFormatReaderExt | 97 | extension JsZXingBrowserMultiFormatReaderExt |
| 93 | on JsZXingBrowserMultiFormatReader { | 98 | on JsZXingBrowserMultiFormatReader { |
-
Please register or login to post a comment