maybeValue<T extends Object> method

T? maybeValue<T extends Object>({
  1. T xxLarge()?,
  2. T xLarge()?,
  3. T large()?,
  4. T medium()?,
  5. T small()?,
  6. T xSmall()?,
})

Proxies the call to value but allows all arguments to be null

When not a single argument is non-nullable, instead of throwing, returns a null instead.

Implementation

T? maybeValue<T extends Object>({
  T Function()? xxLarge,
  T Function()? xLarge,
  T Function()? large,
  T Function()? medium,
  T Function()? small,
  T Function()? xSmall,
}) {
  if (xxLarge == null && xLarge == null && large == null && medium == null && small == null && xSmall == null) {
    return null;
  }

  return value(xxLarge: xxLarge, xLarge: xLarge, large: large, medium: medium, small: small, xSmall: xSmall);
}