Navaron Bracke

add flashlight delegate to barcode reader base

@@ -7,12 +7,16 @@ import 'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'; @@ -7,12 +7,16 @@ import 'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart';
7 import 'package:mobile_scanner/src/mobile_scanner_exception.dart'; 7 import 'package:mobile_scanner/src/mobile_scanner_exception.dart';
8 import 'package:mobile_scanner/src/objects/barcode_capture.dart'; 8 import 'package:mobile_scanner/src/objects/barcode_capture.dart';
9 import 'package:mobile_scanner/src/objects/start_options.dart'; 9 import 'package:mobile_scanner/src/objects/start_options.dart';
  10 +import 'package:mobile_scanner/src/web/flashlight_delegate.dart';
10 import 'package:web/web.dart'; 11 import 'package:web/web.dart';
11 12
12 /// This class represents the base interface for a barcode reader implementation. 13 /// This class represents the base interface for a barcode reader implementation.
13 abstract class BarcodeReader { 14 abstract class BarcodeReader {
14 const BarcodeReader(); 15 const BarcodeReader();
15 16
  17 + /// Get the flashlight delegate for the barcode reader.
  18 + FlashlightDelegate get flashlightDelegate => const FlashlightDelegate();
  19 +
16 /// Whether the scanner is currently scanning for barcodes. 20 /// Whether the scanner is currently scanning for barcodes.
17 bool get isScanning { 21 bool get isScanning {
18 throw UnimplementedError('isScanning has not been implemented.'); 22 throw UnimplementedError('isScanning has not been implemented.');
@@ -7,6 +7,9 @@ import 'package:web/web.dart'; @@ -7,6 +7,9 @@ import 'package:web/web.dart';
7 /// 7 ///
8 /// It provides an interface to query and update the flashlight state of a [MediaStream]. 8 /// It provides an interface to query and update the flashlight state of a [MediaStream].
9 final class FlashlightDelegate { 9 final class FlashlightDelegate {
  10 + /// Constructs a [FlashlightDelegate] instance.
  11 + const FlashlightDelegate();
  12 +
10 /// Returns a list of supported flashlight modes for the given [mediaStream]. 13 /// Returns a list of supported flashlight modes for the given [mediaStream].
11 /// 14 ///
12 /// The [TorchState.off] mode is always supported, regardless of the return value. 15 /// The [TorchState.off] mode is always supported, regardless of the return value.