DeviceUtils class abstract final

Device and platform helpers that work on every target (including web).

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
isDesktop → bool
Whether the current platform is a desktop OS.
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
isMobile → bool
Whether the current platform is a phone/tablet.
no setter
isWeb → bool
Whether the app runs inside a web browser.
no setter
isWindows → bool
Whether the current platform is Windows.
no setter
platform → TargetPlatform
The current target platform (best-effort on web).
no setter

Static Methods

deviceClass(BuildContext context) → String
Approximate device class based on screen width: 'phone', 'tablet' or 'desktop'.
devicePixelRatio(BuildContext context) → double
Device pixel ratio.
isLandscape(BuildContext context) → bool
Whether the screen is wider than it is tall.
isPortrait(BuildContext context) → bool
Whether the screen is taller than it is wide.
safeBottom(BuildContext context) → double
Safe-area bottom padding.
safeTop(BuildContext context) → double
Safe-area top padding.
screenSize(BuildContext context) → Size
Screen size in logical pixels.