value<T> method

T value<T>({
  1. required T mobile,
  2. T? tablet,
  3. T? desktop,
  4. T? wide,
})

Picks the value for the current breakpoint.

Only mobile is required, and larger breakpoints fall back down the ladder to it. Falling down rather than up is deliberate: an unset tablet value takes the phone's, because laying a phone-sized column out with desktop measurements is what overflows, while the reverse merely looks roomy.

Implementation

T value<T>({required T mobile, T? tablet, T? desktop, T? wide}) {
  switch (breakpoint) {
    case DVBreakpoint.wide:
      return wide ?? desktop ?? tablet ?? mobile;
    case DVBreakpoint.desktop:
      return desktop ?? tablet ?? mobile;
    case DVBreakpoint.tablet:
      return tablet ?? mobile;
    case DVBreakpoint.mobile:
      return mobile;
  }
}