Showing
1 changed file
with
4 additions
and
3 deletions
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | -import 'dart:io'; | ||
| 3 | 2 | ||
| 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'; | 6 | import 'package:mobile_scanner/src/enums/barcode_format.dart'; |
| @@ -54,7 +54,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | @@ -54,7 +54,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | ||
| 54 | final List<Map<Object?, Object?>> barcodes = | 54 | final List<Map<Object?, Object?>> barcodes = |
| 55 | data.cast<Map<Object?, Object?>>(); | 55 | data.cast<Map<Object?, Object?>>(); |
| 56 | 56 | ||
| 57 | - if (Platform.isMacOS) { | 57 | + if (defaultTargetPlatform == TargetPlatform.macOS) { |
| 58 | return BarcodeCapture( | 58 | return BarcodeCapture( |
| 59 | raw: event, | 59 | raw: event, |
| 60 | barcodes: barcodes | 60 | barcodes: barcodes |
| @@ -70,7 +70,8 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | @@ -70,7 +70,8 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | ||
| 70 | ); | 70 | ); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | - if (Platform.isAndroid || Platform.isIOS) { | 73 | + if (defaultTargetPlatform == TargetPlatform.android || |
| 74 | + defaultTargetPlatform == TargetPlatform.iOS) { | ||
| 74 | final double? width = event['width'] as double?; | 75 | final double? width = event['width'] as double?; |
| 75 | final double? height = event['height'] as double?; | 76 | final double? height = event['height'] as double?; |
| 76 | 77 |
-
Please register or login to post a comment