whenMaybe<T> method
T
whenMaybe<T>({
- T bool()?,
- T int()?,
- T num()?,
- T str()?,
- T option()?,
- T duration()?,
- T list()?,
- T set()?,
- T map()?,
- T function()?,
- T nested()?,
- T union()?,
- T unionType()?,
- T enumV()?,
- T dynamic()?,
- T late()?,
- required T orElse(),
Implementation
T whenMaybe<T>({
T Function()? bool,
T Function()? int,
T Function()? num,
T Function()? str,
T Function(SerdeTypeOption)? option,
T Function()? duration,
T Function(SerdeTypeList)? list,
T Function(SerdeTypeSet)? set,
T Function(SerdeTypeMap)? map,
T Function()? function,
T Function(SerdeTypeNested)? nested,
T Function(SerdeTypeUnion)? union,
T Function(SerdeTypeUnionType)? unionType,
T Function(SerdeTypeEnum<Object?>)? enumV,
T Function()? dynamic,
T Function(SerdeTypeLate)? late,
required T Function() orElse,
}) {
T orElseParam(Object _) => orElse();
return when(
bool: bool ?? orElse,
int: int ?? orElse,
num: num ?? orElse,
str: str ?? orElse,
option: option ?? orElseParam,
duration: duration ?? orElse,
list: list ?? orElseParam,
set: set ?? orElseParam,
map: map ?? orElseParam,
function: function ?? orElse,
nested: nested ?? orElseParam,
union: union ?? orElseParam,
unionType: unionType ?? orElseParam,
enumV: enumV ?? orElseParam,
dynamic: dynamic ?? orElse,
late: late ?? orElseParam,
);
}