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!

// OLD (required manual init):
await PlatformVersion.initialize();
if (PlatformVersion.isIOS26OrLater) { ... }

// NEW (auto-initializes):
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

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
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

ensureInitialized() → void
Ensures platform info is initialized.
initialize() → Future<void>
Initializes version detection by fetching and caching the OS version.
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 (useful for testing).