responsiveValue<T> method

T responsiveValue<T>({
  1. required T xs,
  2. T? sm,
  3. T? md,
  4. T? lg,
  5. T? xl,
})

Returns a value based on the current breakpoint.

Implementation

T responsiveValue<T>({required T xs, T? sm, T? md, T? lg, T? xl}) {
  if (isXs) return xs;
  if (isSm) return sm ?? xs;
  if (isMd) return md ?? sm ?? xs;
  if (isLg) return lg ?? md ?? sm ?? xs;
  if (isXl) return xl ?? lg ?? md ?? sm ?? xs;
  return xs; // fallback
}