maybeValue<T extends Object> method
T?
maybeValue<T extends Object>({
- T desktop()?,
- T tablet()?,
- T phone()?,
- T tinyHardware()?,
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()? desktop,
T Function()? tablet,
T Function()? phone,
T Function()? tinyHardware,
}) {
if (desktop == null && tablet == null && phone == null && tinyHardware == null) {
return null;
}
return value(desktop: desktop, tablet: tablet, phone: phone, tinyHardware: tinyHardware);
}