Skip to content

Conversation

@holzgeist
Copy link
Contributor

@holzgeist holzgeist commented Feb 10, 2025

Some properties defined in package:web/web.dart are defined as non-nullable, while some browsers don't support them. In my case, aspectRatio is not defined for Firefox, causing a failed non-null check

This seems to be a problem with the IDL itself being inconsistent (see dart-lang/web#309).

Checking availability before accessing the fields seems to be an endorsed method: dart-lang/web#181 (comment)

I tried to refactor the code to use settings.has(property) and settings[propery] in a loop, but then we lose type conversion and our map only contains JSAny. It's a bit verbose, but it's the best I could come up with currently

Some properties defined in `package:web/web.dart` are defined as
non-nullable, while some browsers don't support them.
In my case, `aspectRatio` is not defined for [Firefox](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/aspectRatio#browser_compatibility).

This seems to be a problem with the IDL itself being inconsistent (see dart-lang/web#309).

Checking availability before accessing the fields seems to be an
endorsed method: dart-lang/web#181 (comment)
@holzgeist holzgeist force-pushed the fix-optional-track-settings branch from f0a542e to fc82d90 Compare February 17, 2025 11:01
Copy link
Member

@cloudwebrtc cloudwebrtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg!

@cloudwebrtc cloudwebrtc merged commit 86186a8 into flutter-webrtc:main Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants