Navaron Bracke

format

@@ -30,7 +30,8 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -30,7 +30,8 @@ class MobileScannerWeb extends MobileScannerPlatform {
30 BarcodeReader? _barcodeReader; 30 BarcodeReader? _barcodeReader;
31 31
32 /// The stream controller for the barcode stream. 32 /// The stream controller for the barcode stream.
33 - final StreamController<BarcodeCapture> _barcodesController = StreamController.broadcast(); 33 + final StreamController<BarcodeCapture> _barcodesController =
  34 + StreamController.broadcast();
34 35
35 /// The subscription for the barcode stream. 36 /// The subscription for the barcode stream.
36 StreamSubscription<Object?>? _barcodesSubscription; 37 StreamSubscription<Object?>? _barcodesSubscription;
@@ -44,7 +45,8 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -44,7 +45,8 @@ class MobileScannerWeb extends MobileScannerPlatform {
44 /// because that is the only property for video tracks that can be observed. 45 /// because that is the only property for video tracks that can be observed.
45 /// 46 ///
46 /// See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#instance_properties_of_video_tracks 47 /// See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#instance_properties_of_video_tracks
47 - final StreamController<MediaTrackSettings> _settingsController = StreamController.broadcast(); 48 + final StreamController<MediaTrackSettings> _settingsController =
  49 + StreamController.broadcast();
48 50
49 /// The texture ID for the camera view. 51 /// The texture ID for the camera view.
50 int _textureId = 1; 52 int _textureId = 1;
@@ -63,10 +65,12 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -63,10 +65,12 @@ class MobileScannerWeb extends MobileScannerPlatform {
63 Stream<BarcodeCapture?> get barcodesStream => _barcodesController.stream; 65 Stream<BarcodeCapture?> get barcodesStream => _barcodesController.stream;
64 66
65 @override 67 @override
66 - Stream<TorchState> get torchStateStream => _settingsController.stream.map((_) => TorchState.unavailable); 68 + Stream<TorchState> get torchStateStream =>
  69 + _settingsController.stream.map((_) => TorchState.unavailable);
67 70
68 @override 71 @override
69 - Stream<double> get zoomScaleStateStream => _settingsController.stream.map((_) => 1.0); 72 + Stream<double> get zoomScaleStateStream =>
  73 + _settingsController.stream.map((_) => 1.0);
70 74
71 /// Create the [HTMLVideoElement] along with its parent container [HTMLDivElement]. 75 /// Create the [HTMLVideoElement] along with its parent container [HTMLDivElement].
72 HTMLVideoElement _createVideoElement(int textureId) { 76 HTMLVideoElement _createVideoElement(int textureId) {
@@ -163,12 +167,14 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -163,12 +167,14 @@ class MobileScannerWeb extends MobileScannerPlatform {
163 throw const MobileScannerException( 167 throw const MobileScannerException(
164 errorCode: MobileScannerErrorCode.unsupported, 168 errorCode: MobileScannerErrorCode.unsupported,
165 errorDetails: MobileScannerErrorDetails( 169 errorDetails: MobileScannerErrorDetails(
166 - message: 'This browser does not support displaying video from the camera.', 170 + message:
  171 + 'This browser does not support displaying video from the camera.',
167 ), 172 ),
168 ); 173 );
169 } 174 }
170 175
171 - final MediaTrackSupportedConstraints capabilities = window.navigator.mediaDevices.getSupportedConstraints(); 176 + final MediaTrackSupportedConstraints capabilities =
  177 + window.navigator.mediaDevices.getSupportedConstraints();
172 178
173 final MediaStreamConstraints constraints; 179 final MediaStreamConstraints constraints;
174 180
@@ -189,7 +195,8 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -189,7 +195,8 @@ class MobileScannerWeb extends MobileScannerPlatform {
189 195
190 try { 196 try {
191 // Retrieving the media devices requests the camera permission. 197 // Retrieving the media devices requests the camera permission.
192 - final MediaStream videoStream = await window.navigator.mediaDevices.getUserMedia(constraints).toDart; 198 + final MediaStream videoStream =
  199 + await window.navigator.mediaDevices.getUserMedia(constraints).toDart;
193 200
194 return videoStream; 201 return videoStream;
195 } on DOMException catch (error, stackTrace) { 202 } on DOMException catch (error, stackTrace) {
@@ -198,7 +205,8 @@ class MobileScannerWeb extends MobileScannerPlatform { @@ -198,7 +205,8 @@ class MobileScannerWeb extends MobileScannerPlatform {
198 MobileScannerErrorCode errorCode = MobileScannerErrorCode.genericError; 205 MobileScannerErrorCode errorCode = MobileScannerErrorCode.genericError;
199 206
200 // Handle both unsupported and permission errors from the web. 207 // Handle both unsupported and permission errors from the web.
201 - if (errorMessage.contains('NotFoundError') || errorMessage.contains('NotSupportedError')) { 208 + if (errorMessage.contains('NotFoundError') ||
  209 + errorMessage.contains('NotSupportedError')) {
202 errorCode = MobileScannerErrorCode.unsupported; 210 errorCode = MobileScannerErrorCode.unsupported;
203 } else if (errorMessage.contains('NotAllowedError')) { 211 } else if (errorMessage.contains('NotAllowedError')) {
204 errorCode = MobileScannerErrorCode.permissionDenied; 212 errorCode = MobileScannerErrorCode.permissionDenied;