let MacOS also use the same barcode format parsing as iOS/Android
Showing
1 changed file
with
2 additions
and
18 deletions
| @@ -3,7 +3,6 @@ import 'dart:async'; | @@ -3,7 +3,6 @@ import 'dart:async'; | ||
| 3 | import 'package:flutter/foundation.dart'; | 3 | import 'package:flutter/foundation.dart'; |
| 4 | import 'package:flutter/services.dart'; | 4 | import 'package:flutter/services.dart'; |
| 5 | import 'package:flutter/widgets.dart'; | 5 | import 'package:flutter/widgets.dart'; |
| 6 | -import 'package:mobile_scanner/src/enums/barcode_format.dart'; | ||
| 7 | import 'package:mobile_scanner/src/enums/mobile_scanner_authorization_state.dart'; | 6 | import 'package:mobile_scanner/src/enums/mobile_scanner_authorization_state.dart'; |
| 8 | import 'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'; | 7 | import 'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'; |
| 9 | import 'package:mobile_scanner/src/enums/torch_state.dart'; | 8 | import 'package:mobile_scanner/src/enums/torch_state.dart'; |
| @@ -54,24 +53,9 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | @@ -54,24 +53,9 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | ||
| 54 | final List<Map<Object?, Object?>> barcodes = | 53 | final List<Map<Object?, Object?>> barcodes = |
| 55 | data.cast<Map<Object?, Object?>>(); | 54 | data.cast<Map<Object?, Object?>>(); |
| 56 | 55 | ||
| 57 | - if (defaultTargetPlatform == TargetPlatform.macOS) { | ||
| 58 | - return BarcodeCapture( | ||
| 59 | - raw: event, | ||
| 60 | - barcodes: barcodes | ||
| 61 | - .map( | ||
| 62 | - (barcode) => Barcode( | ||
| 63 | - rawValue: barcode['payload'] as String?, | ||
| 64 | - format: BarcodeFormat.fromRawValue( | ||
| 65 | - barcode['symbology'] as int? ?? -1, | ||
| 66 | - ), | ||
| 67 | - ), | ||
| 68 | - ) | ||
| 69 | - .toList(), | ||
| 70 | - ); | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | if (defaultTargetPlatform == TargetPlatform.android || | 56 | if (defaultTargetPlatform == TargetPlatform.android || |
| 74 | - defaultTargetPlatform == TargetPlatform.iOS) { | 57 | + defaultTargetPlatform == TargetPlatform.iOS || |
| 58 | + defaultTargetPlatform == TargetPlatform.macOS) { | ||
| 75 | final Map<String, Object?>? imageData = | 59 | final Map<String, Object?>? imageData = |
| 76 | event['image'] as Map<String, Object?>?; | 60 | event['image'] as Map<String, Object?>?; |
| 77 | final Uint8List? image = imageData?['bytes'] as Uint8List?; | 61 | final Uint8List? image = imageData?['bytes'] as Uint8List?; |
-
Please register or login to post a comment