BreakpointValue<T> class

A class that provides a value based on the current screen size breakpoints.

This allows for discrete responsive values (e.g., column counts or font sizes) instead of continuous scaling. It resolves the most appropriate value based on the device type detected by FlexiConfig.

Example:

const columnCount = BreakpointValue<int>(
  mobile: 1,
  tablet: 2,
  desktop: 4,
);
...
GridView.count(crossAxisCount: columnCount.v(context));
Available extensions

Constructors

BreakpointValue({required T mobile, T? tablet, T? desktop})
const

Properties

desktop → T?
The value used for desktop screens.
final
hashCode → int
The hash code for this object.
no setterinherited
mobile → T
The value used for mobile devices (portrait).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tablet → T?
The value used for tablets or landscape mobile devices.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(BuildContext context) → T
Resolves the value based on the current BuildContext.
toString() → String
A string representation of this object.
inherited
v(BuildContext context) → T

Available on BreakpointValue<T>, provided by the BreakpointExtension extension

Shorthand for resolving the value.

Operators

operator ==(Object other) → bool
The equality operator.
inherited