when<T> method

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

Implementation

T when<T>({
  required T Function() mobile,
  required T Function() tablet,
  required T Function() desktop,
  T Function()? widescreen,
}) => switch (this) {
  Breakpoint.mobile => mobile(),
  Breakpoint.tablet => tablet(),
  Breakpoint.desktop => desktop(),
  Breakpoint.widescreen => widescreen != null ? widescreen() : desktop(),
};