Navaron Bracke

remove some redundant casts

@@ -9,17 +9,13 @@ final class MediaTrackConstraintsDelegate { @@ -9,17 +9,13 @@ final class MediaTrackConstraintsDelegate {
9 9
10 /// Get the settings for the given [mediaStream]. 10 /// Get the settings for the given [mediaStream].
11 MediaTrackSettings? getSettings(MediaStream? mediaStream) { 11 MediaTrackSettings? getSettings(MediaStream? mediaStream) {
12 - final List<JSAny?>? tracks = mediaStream?.getVideoTracks().toDart; 12 + final List<MediaStreamTrack>? tracks = mediaStream?.getVideoTracks().toDart;
13 13
14 if (tracks == null || tracks.isEmpty) { 14 if (tracks == null || tracks.isEmpty) {
15 return null; 15 return null;
16 } 16 }
17 17
18 - final MediaStreamTrack? track = tracks.first as MediaStreamTrack?;  
19 -  
20 - if (track == null) {  
21 - return null;  
22 - } 18 + final MediaStreamTrack track = tracks.first;
23 19
24 final MediaTrackCapabilities capabilities = track.getCapabilities(); 20 final MediaTrackCapabilities capabilities = track.getCapabilities();
25 final MediaTrackSettings settings = track.getSettings(); 21 final MediaTrackSettings settings = track.getSettings();
@@ -115,8 +115,8 @@ final class ZXingBarcodeReader extends BarcodeReader { @@ -115,8 +115,8 @@ final class ZXingBarcodeReader extends BarcodeReader {
115 ) async { 115 ) async {
116 final JSPromise? result = _reader?.attachStreamToVideo.callAsFunction( 116 final JSPromise? result = _reader?.attachStreamToVideo.callAsFunction(
117 _reader as JSAny?, 117 _reader as JSAny?,
118 - videoStream as JSAny,  
119 - videoElement as JSAny, 118 + videoStream,
  119 + videoElement,
120 ) as JSPromise?; 120 ) as JSPromise?;
121 121
122 await result?.toDart; 122 await result?.toDart;
@@ -136,7 +136,7 @@ final class ZXingBarcodeReader extends BarcodeReader { @@ -136,7 +136,7 @@ final class ZXingBarcodeReader extends BarcodeReader {
136 controller.onListen = () { 136 controller.onListen = () {
137 _reader?.decodeContinuously.callAsFunction( 137 _reader?.decodeContinuously.callAsFunction(
138 _reader as JSAny?, 138 _reader as JSAny?,
139 - _reader?.videoElement as JSAny?, 139 + _reader?.videoElement,
140 (Result? result, JSAny? error) { 140 (Result? result, JSAny? error) {
141 if (controller.isClosed || result == null) { 141 if (controller.isClosed || result == null) {
142 return; 142 return;