Skip to content

Commit

Permalink
fix type cast exception in getConstraints()
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Hull committed Apr 30, 2024
1 parent 4e87ddc commit 84a0172
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/src/media_stream_track_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class MediaStreamTrackWeb extends MediaStreamTrack {

@override
Map<String, dynamic> getConstraints() {
return jsTrack.getConstraints() as Map<String, dynamic>;
final c = jsTrack.getConstraints();
final jso = (c as JSObject).dartify();
return (jso as Map).cast<String, dynamic>();
}

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

final _val = await js.promiseToFuture<void>(
js.callMethod(jsTrack, 'applyConstraints', [arg]));
js.callMethod(jsTrack, 'applyConstraints', [arg]),
);
return _val;
}

Expand Down

0 comments on commit 84a0172

Please sign in to comment.