PlatformUtils class abstract final

Platform detection for the adaptive design system.

isCupertino is based on defaultTargetPlatform — not dart:io — so it is overridable in widget tests.

To force a rendering in ANY build mode (release included, e.g. a deployed web gallery), use debugOverridePlatform. Do NOT rely on debugDefaultTargetPlatformOverride for that: it is debug-only — setting it throws in a release build, and defaultTargetPlatform ignores it outside debug.

The isIOS, isAndroid … getters report the REAL host OS through a conditional import (dart:io does not exist on web). A DIRECT import 'dart:io' would break the web build even under a kIsWeb guard — it is the import itself that is rejected, not its execution. Reserve these getters for non-UI concerns (permissions, store links, file paths).

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

debugOverridePlatform ↔ TargetPlatform?
Forces the Cupertino/Material rendering, in every build mode.
getter/setter pair
isAndroid → bool
no setter
isCupertino → bool
no setter
isDesktop → bool
no setter
isIOS → bool
no setter
isLinux → bool
no setter
isMacOS → bool
no setter
isMaterial → bool
no setter
isMobile → bool
no setter
isWeb → bool
no setter
isWindows → bool
no setter