Navaron Bracke

convert camera facing & detection speed to enhanced enums

1 /// The facing of a camera. 1 /// The facing of a camera.
2 enum CameraFacing { 2 enum CameraFacing {
3 /// Front facing camera. 3 /// Front facing camera.
4 - front, 4 + front(0),
5 5
6 /// Back facing camera. 6 /// Back facing camera.
7 - back, 7 + back(1);
  8 +
  9 + const CameraFacing(this.rawValue);
  10 +
  11 + /// The raw value for the camera facing direction.
  12 + final int rawValue;
8 } 13 }
@@ -5,16 +5,21 @@ enum DetectionSpeed { @@ -5,16 +5,21 @@ enum DetectionSpeed {
5 /// 5 ///
6 /// NOTE: This mode does analyze every frame in order to check if the value 6 /// NOTE: This mode does analyze every frame in order to check if the value
7 /// has changed. 7 /// has changed.
8 - noDuplicates, 8 + noDuplicates(0),
9 9
10 /// The barcode scanner will scan one barcode, and wait 250 Miliseconds before 10 /// The barcode scanner will scan one barcode, and wait 250 Miliseconds before
11 /// scanning again. This will prevent memory issues on older devices. 11 /// scanning again. This will prevent memory issues on older devices.
12 /// 12 ///
13 /// You can change the timeout duration with [detectionTimeout] parameter. 13 /// You can change the timeout duration with [detectionTimeout] parameter.
14 - normal, 14 + normal(1),
15 15
16 /// Let the scanner detect barcodes without restriction. 16 /// Let the scanner detect barcodes without restriction.
17 /// 17 ///
18 /// NOTE: This can cause memory issues with older devices. 18 /// NOTE: This can cause memory issues with older devices.
19 - unrestricted, 19 + unrestricted(2);
  20 +
  21 + const DetectionSpeed(this.rawValue);
  22 +
  23 + /// The raw value for the detection speed.
  24 + final int rawValue;
20 } 25 }