NullableUndefineableJSAnyExtension extension
JS undefined
and JS null
are internalized differently based on the
backends. In the JS backends, Dart null
can actually be JS undefined
or
JS null
. In dart2wasm, that's not the case: there's only one Wasm value
null
can be. Therefore, when we get back JS null
or JS undefined
, we
internalize both as Dart null
in dart2wasm, and when we pass Dart null
to an interop API, we pass JS null
. In the JS backends, Dart null
retains its original value when passed back to an interop API. Be wary of
writing code where this distinction between null
and undefined
matters.
- on
Properties
- isDefinedAndNotNull → bool
-
no setter
- isNull → bool
-
Determine if this value corresponds to JS
null
.no setter - isUndefined → bool
-
Determine if this value corresponds to JS
undefined
.no setter - isUndefinedOrNull → bool
-
no setter