ResponsiveUtils class

Utilities for managing breakpoint configuration and deriving the active DeviceType from a screen width.

Populated by ResponsiveInit, these helpers are used by widgets and extensions to decide when and how to scale UI.

Annotations
  • @Deprecated('Use ResponsiveScope from v2 API (flutter_screen_responsive.dart). ' 'v1 will be removed in a future major release.')

Constructors

ResponsiveUtils()

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

breakpoints → Map<DeviceType, Breakpoints>
Registry of breakpoint rules by DeviceType.
final
currentDeviceType ↔ DeviceType
The most recently computed device type.
getter/setter pair
getDeviceType → DeviceType
Returns the latest computed device type.
no setter
isDesktop → bool
True if width maps to DeviceType.desktop.
no setter
isDesktopLarge → bool
True if width maps to DeviceType.desktopLarge.
no setter
isLaptop → bool
True if width maps to DeviceType.laptop.
no setter
isMobile → bool
True if width maps to DeviceType.mobile.
no setter
isMobileSmall → bool
True if width maps to DeviceType.mobileSmall.
no setter
isNeedScreenUtil → bool
Whether automatic scaling (via ScreenUtil) should be enabled for the current device type, as specified by the active Breakpoints.
no setter
isTablet → bool
True if width maps to DeviceType.tablet.
no setter
isTabletSmall → bool
True if width maps to DeviceType.tabletSmall.
no setter

Static Methods

breakpointForWidth(double width) → Breakpoints
registerBreakpoints(List<Breakpoints> entries) → void
Registers and sorts breakpoint definitions.
setDeviceType(double width) → DeviceType
Computes and stores the DeviceType for a given layout width.
value<T>({T? mobileSmall, T? mobile, T? tabletSmall, T? tablet, T? desktop, T? desktopLarge}) → T
Picks the value for the current DeviceType, falling back in this order when the preferred value is null: desktopLarge → desktop → tablet → tabletSmall → mobile → mobileSmall.