Showing
3 changed files
with
8 additions
and
9 deletions
| @@ -151,7 +151,7 @@ class BarcodeOverlay extends CustomPainter { | @@ -151,7 +151,7 @@ class BarcodeOverlay extends CustomPainter { | ||
| 151 | 151 | ||
| 152 | @override | 152 | @override |
| 153 | void paint(Canvas canvas, Size size) { | 153 | void paint(Canvas canvas, Size size) { |
| 154 | - if (barcode.corners == null) { | 154 | + if (barcode.corners.isEmpty) { |
| 155 | return; | 155 | return; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| @@ -183,7 +183,7 @@ class BarcodeOverlay extends CustomPainter { | @@ -183,7 +183,7 @@ class BarcodeOverlay extends CustomPainter { | ||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | final List<Offset> adjustedOffset = []; | 185 | final List<Offset> adjustedOffset = []; |
| 186 | - for (final offset in barcode.corners!) { | 186 | + for (final offset in barcode.corners) { |
| 187 | adjustedOffset.add( | 187 | adjustedOffset.add( |
| 188 | Offset( | 188 | Offset( |
| 189 | offset.dx / ratioWidth + horizontalPadding, | 189 | offset.dx / ratioWidth + horizontalPadding, |
| @@ -130,8 +130,6 @@ class MobileScannerWebPlugin { | @@ -130,8 +130,6 @@ class MobileScannerWebPlugin { | ||
| 130 | _barCodeStreamSubscription = | 130 | _barCodeStreamSubscription = |
| 131 | barCodeReader.detectBarcodeContinuously().listen((code) { | 131 | barCodeReader.detectBarcodeContinuously().listen((code) { |
| 132 | if (code != null) { | 132 | if (code != null) { |
| 133 | - final List<Offset>? corners = code.corners; | ||
| 134 | - | ||
| 135 | controller.add({ | 133 | controller.add({ |
| 136 | 'name': 'barcodeWeb', | 134 | 'name': 'barcodeWeb', |
| 137 | 'data': { | 135 | 'data': { |
| @@ -140,8 +138,8 @@ class MobileScannerWebPlugin { | @@ -140,8 +138,8 @@ class MobileScannerWebPlugin { | ||
| 140 | 'format': code.format.rawValue, | 138 | 'format': code.format.rawValue, |
| 141 | 'displayValue': code.displayValue, | 139 | 'displayValue': code.displayValue, |
| 142 | 'type': code.type.rawValue, | 140 | 'type': code.type.rawValue, |
| 143 | - if (corners != null && corners.isNotEmpty) | ||
| 144 | - 'corners': corners | 141 | + if (code.corners.isNotEmpty) |
| 142 | + 'corners': code.corners | ||
| 145 | .map( | 143 | .map( |
| 146 | (Offset c) => <Object?, Object?>{'x': c.dx, 'y': c.dy}, | 144 | (Offset c) => <Object?, Object?>{'x': c.dx, 'y': c.dy}, |
| 147 | ) | 145 | ) |
| @@ -442,9 +442,10 @@ class MobileScannerController { | @@ -442,9 +442,10 @@ class MobileScannerController { | ||
| 442 | rawBytes: barcode['rawBytes'] as Uint8List?, | 442 | rawBytes: barcode['rawBytes'] as Uint8List?, |
| 443 | format: toFormat(barcode['format'] as int), | 443 | format: toFormat(barcode['format'] as int), |
| 444 | corners: toCorners( | 444 | corners: toCorners( |
| 445 | - (barcode['corners'] as List<Object?>? ?? []) | ||
| 446 | - .cast<Map<Object?, Object?>>(), | ||
| 447 | - ), | 445 | + (barcode['corners'] as List<Object?>? ?? []) |
| 446 | + .cast<Map<Object?, Object?>>(), | ||
| 447 | + ) ?? | ||
| 448 | + const <Offset>[], | ||
| 448 | ), | 449 | ), |
| 449 | ], | 450 | ], |
| 450 | ), | 451 | ), |
-
Please register or login to post a comment