choose method

T choose(
  1. double width
)

Chooses a value based on which of breakpoints is satisfied by width.

Implementation

T choose(double width) {
  for (int i = breakpoints.length - 1; i >= 0; i--) {
    if (width >= breakpoints[i] && values[i] != null) {
      // It's been checked above that the value is non-null
      return values[i]!;
    }
  }
  // it is enforced that the smallest breakpoint Widget/value must be provided
  return values[0]!;
}