mapOrNull<TResult extends Object?> method
TResult?
mapOrNull<TResult extends Object?>({
- TResult? done(
- PickerLoadStatusDone value
- TResult? error(
- PickerLoadStatusError value
- TResult? progress(
- PickerLoadStatusProgress value
A variant of map that fallback to returning null.
It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( PickerLoadStatusDone value)? done,TResult? Function( PickerLoadStatusError value)? error,TResult? Function( PickerLoadStatusProgress value)? progress,}){
final _that = this;
switch (_that) {
case PickerLoadStatusDone() when done != null:
return done(_that);case PickerLoadStatusError() when error != null:
return error(_that);case PickerLoadStatusProgress() when progress != null:
return progress(_that);case _:
return null;
}
}