value<T> method

T value<T>({
  1. required List<Breakpoint> when,
  2. required T value,
  3. required T ifnot,
})

Returns a value based on the current device type.

  • phone: Value to return if the device is a phone.
  • tablet: Value to return if the device is a tablet.
  • computer: Value to return if the device is a computer.

Example usage:

final rp = Provider.of<ResponsiveProvider>(context);
final flexWidth = rp.value(when: [Breakpoint.xs], value: 1.0, ifnot: 1 / 4,)

Implementation

T value<T>({required List<Breakpoint> when, required T value, required T ifnot}) {
  if (when.contains(breakpoint)) return value;
  return ifnot;
}