PlatformDevice class abstract final

A utility library to identify and interact with the platform type of the current device.

This library provides an abstraction for determining the device's operating system, categorizing platforms, and simplifying platform-specific logic in your Flutter applications.

Example Usage

if (PlatformDevice.isWeb) {
  print("Running on a web browser");
}

if (PlatformDevice.isApple) {
  print("Running on an Apple device (macOS or iOS)");
}

print("Operating system: ${PlatformDevice.operatingSystem}");

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
Returns true if the platform is Android.
no setter
isApple → bool
Returns true if the platform is either iOS or macOS.
no setter
isDesktop → bool
Returns true if the platform is a desktop system (Linux, macOS, or Windows).
no setter
isDesktopOrWeb → bool
Returns true if the platform is either a desktop system or a web browser.
no setter
isFuchsia → bool
Returns true if the platform is Fuchsia.
no setter
isIOS → bool
Returns true if the platform is iOS.
no setter
isLinux → bool
Returns true if the platform is Linux.
no setter
isMacOS → bool
Returns true if the platform is macOS.
no setter
isMobile → bool
Returns true if the platform is either iOS or Android.
no setter
isWeb → bool
Returns true if the platform is a web browser.
no setter
isWindows → bool
Returns true if the platform is Windows.
no setter
operatingSystem → String
Gets the operating system name as a lowercase string.
no setter
value → PlatformType
Retrieves the current platform type as a PlatformType enum.
no setter