Skip to content

Commit 50cab00

Browse files
authored
Merge pull request #35 from mrcsh/main
fix type cast exception in getConstraints()
2 parents fe84e04 + 84a0172 commit 50cab00

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/media_stream_track_impl.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class MediaStreamTrackWeb extends MediaStreamTrack {
3737

3838
@override
3939
Map<String, dynamic> getConstraints() {
40-
return jsTrack.getConstraints() as Map<String, dynamic>;
40+
final c = jsTrack.getConstraints();
41+
final jso = (c as JSObject).dartify();
42+
return (jso as Map).cast<String, dynamic>();
4143
}
4244

4345
@override
@@ -47,7 +49,8 @@ class MediaStreamTrackWeb extends MediaStreamTrack {
4749
final arg = js.jsify(constraints ?? {});
4850

4951
final _val = await js.promiseToFuture<void>(
50-
js.callMethod(jsTrack, 'applyConstraints', [arg]));
52+
js.callMethod(jsTrack, 'applyConstraints', [arg]),
53+
);
5154
return _val;
5255
}
5356

0 commit comments

Comments
 (0)