current property

Platforms get current

The current platform the Flutter application us running on.

Implementation

Platforms get current {
  // Return the override for the current platform if present.
  if (override != null) {
    return override!;
  }

  if (_isChromeExtension) {
    return Platforms.chromeExtension;
  }

  if (_isWeb) {
    return Platforms.web;
  }

  if (_isAndroid) {
    return Platforms.android;
  }

  if (_isIOS) {
    return Platforms.iOS;
  }

  if (_isMacOS) {
    return Platforms.macOS;
  }

  if (_isLinux) {
    return Platforms.linux;
  }

  if (_isFuschia) {
    return Platforms.fuschia;
  }

  if (_isWindows) {
    return Platforms.windows;
  }

  throw 'unsupported platform';
}