NullableUndefineableJSAnyExtension extension - dart:js_interop library (original) (raw)
Helper methods to determine if a value is JavaScript undefined
or null
.
Note
The members within these extensions may throw depending on the platform. Do not rely on them to be platform-consistent.
JavaScript undefined
and JavaScript null
are internalized differently based on the backend. When compiling to JavaScript, Dart null
can actually be JavaScript undefined
or JavaScript null
. When compiling to Wasm, that's not the case: there's only one Wasm value null
can be. Therefore, when an interop API returns JavaScript null
or JavaScript undefined
, they are both converted to Dart null
when compiling to Wasm, and when you pass a Dart null
to an interop API, it is called with JavaScript null
. When compiling to JavaScript, Dart null
retains its original JavaScript value. Avoid writing code where this distinction between null
andundefined
matters.
on
Properties
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScript null
.
no setter
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScript undefined
.
no setter
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter