dart-lang / web

Lightweight browser API bindings built around JS static interop.
https://pub.dev/packages/web
BSD 3-Clause "New" or "Revised" License
135 stars 24 forks source link

Return `String` should be nullable, no? #309

Open kevmoo opened 2 months ago

kevmoo commented 2 months ago

https://github.com/dart-lang/web/blob/6538aca01c8b3edb00e085d7e349e61f04a746a0/web/lib/src/dom/html.dart#L1281

CC @srujzs

srujzs commented 1 month ago

This is similar to https://github.com/dart-lang/web/issues/181. The IDL claims the return type is non-nullable, but naturally it would be nice to coerce missing values to null instead of a cast failure. I'm not sure if the behavior is similar everywhere a getter is declared in the IDL to make that change. The current solution is using has to check for existence.