PlatformVersion class

Utility class for checking OS version with caching and auto-initialization.

This class provides cached version detection that auto-initializes on first access - no manual initialization needed!

if (PlatformVersion.isIOS26OrLater) { ... }

Constructors

PlatformVersion()

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

debugForceFallbacks ↔ bool
When true, shouldUseNativeControls and shouldUseNativeGlass are false, so every widget takes its Flutter fallback on any host.
getter/setter pair
iosVersion → int?
Gets the iOS major version, auto-initializing if needed.
no setter
isAndroid → bool
Returns true if running on Android.
no setter
isApple → bool
Returns true if running on Apple platform (iOS or macOS).
no setter
isIOS → bool
Returns true if running on iOS (any version).
no setter
isIOS26OrLater → bool
Returns true if running on iOS 26 or later.
no setter
isMacOS → bool
Returns true if running on macOS (any version).
no setter
isMacOS26OrLater → bool
Returns true if running on macOS 26 or later.
no setter
macOSVersion → int?
Gets the macOS major version, auto-initializing if needed.
no setter
shouldUseNativeControls → bool
Returns true if a widget whose native view is a standard AppKit or UIKit control should use it: on every supported macOS, where those controls predate Liquid Glass, and on iOS 26 or later. Styling that needs Liquid Glass keeps checking isMacOS26OrLater / isIOS26OrLater.
no setter
shouldUseNativeGlass → bool
Returns true if native Liquid Glass effects should be used.
no setter
supportsLiquidGlass → bool
Alias for shouldUseNativeGlass.
no setter
supportsSFSymbols → bool
Returns true if SF Symbols are supported (iOS/macOS).
no setter

Static Methods

debugOverrideVersions({int? iosVersion, int? macOSVersion}) → void
Pretends the running OS has these major versions, so a test can check the version gates (e.g. macOS 15, where shouldUseNativeGlass is false but shouldUseNativeControls is true). Platform itself is not changed. Call reset afterwards.
ensureInitialized() → void
Ensures platform info is initialized.
isIOSVersionInRange(int min, [int? max]) → bool
Checks if iOS version is in the specified range.
isMacOSVersionInRange(int min, [int? max]) → bool
Checks if macOS version is in the specified range.
reset() → void
Forces a refresh of the cached version and turns debugForceFallbacks off (useful for testing).