Open
Description
I've noticed that you always need a !
assertion after .jsify()
to get a JSAny:
document.body!.addEventListener(
"click",
(JSAny e) {
print("click");
console.log(e);
}.toJS,
{"once": true}.jsify()!);
Since extension methods on overlapping types (one more specific than another) work great in Dart, it seems like you could add this to dart:js_interop
so that the result of .jsify()
is non-nullable if the receiver is non-nullable:
extension ObjectUtilExtension on Object {
JSAny jsify() => NullableObjectUtilExtension(this).jsify()!;
}
Am I missing a case where the result of .jsify()
would be null for a non-null receiver?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status