DeviceQueryData class Null safety

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. [...]
read-only, inherited
isCar bool
read-only
isDesktop bool
read-only
isPhone bool
read-only
isTablet bool
read-only
isTv bool
read-only
isWatch bool
read-only
isWeb bool
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited