Navaron Bracke

make the start method return a Future<void> in the platform interface; remove th…

…e view attributes from the buildCameraView() function
1 import 'package:flutter/widgets.dart'; 1 import 'package:flutter/widgets.dart';
2 import 'package:mobile_scanner/src/enums/camera_facing.dart'; 2 import 'package:mobile_scanner/src/enums/camera_facing.dart';
3 import 'package:mobile_scanner/src/method_channel/mobile_scanner_method_channel.dart'; 3 import 'package:mobile_scanner/src/method_channel/mobile_scanner_method_channel.dart';
4 -import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart';  
5 import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 4 import 'package:plugin_platform_interface/plugin_platform_interface.dart';
6 5
7 /// The platform interface for the `mobile_scanner` plugin. 6 /// The platform interface for the `mobile_scanner` plugin.
@@ -34,7 +33,7 @@ abstract class MobileScannerPlatform extends PlatformInterface { @@ -34,7 +33,7 @@ abstract class MobileScannerPlatform extends PlatformInterface {
34 } 33 }
35 34
36 /// Build the camera view for the barcode scanner. 35 /// Build the camera view for the barcode scanner.
37 - Widget buildCameraView(covariant MobileScannerViewAttributes attributes) { 36 + Widget buildCameraView() {
38 throw UnimplementedError('buildCameraView() has not been implemented.'); 37 throw UnimplementedError('buildCameraView() has not been implemented.');
39 } 38 }
40 39
@@ -52,12 +51,12 @@ abstract class MobileScannerPlatform extends PlatformInterface { @@ -52,12 +51,12 @@ abstract class MobileScannerPlatform extends PlatformInterface {
52 throw UnimplementedError('setZoomScale() has not been implemented.'); 51 throw UnimplementedError('setZoomScale() has not been implemented.');
53 } 52 }
54 53
55 - /// Start scanning for barcodes. 54 + /// Start the barcode scanner and prepare a scanner view.
56 /// 55 ///
57 /// Upon calling this method, the necessary camera permission will be requested. 56 /// Upon calling this method, the necessary camera permission will be requested.
58 /// 57 ///
59 - /// Returns an instance of [MobileScannerViewAttributes].  
60 - Future<MobileScannerViewAttributes> start({CameraFacing? cameraDirection}) { 58 + /// The given [cameraDirection] is used as the direction for the camera that needs to be set up.
  59 + Future<void> start(CameraFacing cameraDirection) {
61 throw UnimplementedError('start() has not been implemented.'); 60 throw UnimplementedError('start() has not been implemented.');
62 } 61 }
63 62