isRunningInWeb top-level constant

bool const isRunningInWeb

Tells whether the code is running in a web browser.

If the application has been compiled to Javascript, isRunningInJs will also be true.

Example

import 'package:os/os.dart';

void doSomething() {
  if (isRunningInWeb) {
    // ...
  } else {
    // ...
  }
}

See also

Implementation

const bool isRunningInWeb = bool.fromEnvironment('dart.library.html');