DeviceQueryData class

Information about a piece of device (e.g., a window).

For example, the DeviceQueryData.size property contains the width and height of the current window.

To obtain the current DeviceQueryData for a given BuildContext, use the DeviceQuery.of function. For example, to obtain the size of the current window, use DeviceQuery.of(context).size.

If no DeviceQuery is in scope then the DeviceQuery.of method will throw an exception. Alternatively, DeviceQuery.maybeOf may be used, which returns null instead of throwing if no DeviceQuery is in scope.

Annotations

Constructors

DeviceQueryData({required DeviceType deviceType})
Creates data for a device query with explicit values.
const
DeviceQueryData.detect({BuildContext? context, MediaQueryData? mediaQueryData, double shortestSideBreakpoint = MAX_PHONE_SHORTEST_SIDE})
Creates a new DeviceQueryData depending on platform.
factory

Properties

deviceType DeviceType
final
hashCode int
The hash code for this object.
no setterinherited
isCar bool
no setter
isDesktop bool
no setter
isPhone bool
no setter
isTablet bool
no setter
isTv bool
no setter
isWatch bool
no setter
isWeb bool
no setter
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