band<T> method

T band<T>(
  1. Map<double, T> values
)

The value for the band the window's width is in: values keyed by each band's least width, in ascending order. A window narrower than the first key takes the first value.

Implementation

T band<T>(Map<double, T> values) {
  final width = MediaQuery.sizeOf(this).width;
  late T out;
  var first = true;
  for (final MapEntry(:key, :value) in values.entries) {
    if (!first && width < key) break;
    out = value;
    first = false;
  }
  if (first) throw ArgumentError.value(values, 'values', 'no band');
  return out;
}