isRunningInJs top-level constant
bool
const isRunningInJs
Tells whether the code is running in a Javascript interpreter.
Note that this may be false even if isRunningInWeb is true. For example, the application could have been compiled to Web Assembly (WASM).
Example
import 'package:os/os.dart';
void doSomething() {
if (isRunningInJs) {
// ...
} else {
// ...
}
}
See also
Implementation
const bool isRunningInJs =
bool.fromEnvironment('dart.library.js') && 0 is double;