CurrentPlatform class

Platform detection utility for identifying the current runtime environment.

Provides static methods and properties to detect the current platform, including mobile platforms (Android, iOS), desktop platforms (macOS, Windows, Linux), web environments, and special environments like Fuchsia or Flutter tests.

This utility automatically selects the appropriate platform detection implementation based on the available Dart libraries, ensuring accurate platform identification across all supported environments.

Example usage:

if (CurrentPlatform.isAndroid) {
  // Android-specific code
} else if (CurrentPlatform.isIos) {
  // iOS-specific code
}

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

isAndroid bool
Whether the current platform is Android.
no setter
isFlutterTest bool
Whether the current environment is a Flutter test.
no setter
isFuchsia bool
Whether the current platform is Fuchsia.
no setter
isIos bool
Whether the current platform is iOS.
no setter
isLinux bool
Whether the current platform is Linux.
no setter
isMacOS bool
Whether the current platform is macOS.
no setter
isWeb bool
Whether the current platform is web.
no setter
isWindows bool
Whether the current platform is Windows.
no setter
operatingSystem String
The operating system name as a string.
no setter
type PlatformType
The current platform type.
no setter