maybeMap<TResult extends Object?> method
- @optionalTypeArgs
- TResult create(
- URepoApplyWritesWritesCreate value
- TResult update(
- URepoApplyWritesWritesUpdate value
- TResult delete(
- URepoApplyWritesWritesDelete value
- TResult unknown(
- URepoApplyWritesWritesUnknown value
- required TResult orElse(),
A variant of map
that fallback to returning orElse
.
It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case _:
return orElse();
}
Implementation
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( URepoApplyWritesWritesCreate value)? create,TResult Function( URepoApplyWritesWritesUpdate value)? update,TResult Function( URepoApplyWritesWritesDelete value)? delete,TResult Function( URepoApplyWritesWritesUnknown value)? unknown,required TResult orElse(),}){
final _that = this;
switch (_that) {
case URepoApplyWritesWritesCreate() when create != null:
return create(_that);case URepoApplyWritesWritesUpdate() when update != null:
return update(_that);case URepoApplyWritesWritesDelete() when delete != null:
return delete(_that);case URepoApplyWritesWritesUnknown() when unknown != null:
return unknown(_that);case _:
return orElse();
}
}