isJsRuntime top-level property

bool isJsRuntime
final

True when running on the JS runtime (Flutter web / dart2js / dartdevc).

Detection is via identical(0, 0.0): on the Dart VM the int 0 and the double 0.0 are distinct objects (different runtime types), but on JS both are the same Number, so the identity check passes there. Computed once at load and held in a final to avoid per-call overhead.

Implementation

final bool isJsRuntime = identical(0, 0.0);