maybeMap<TResult extends Object?> method
- @optionalTypeArgs
- TResult repoRef(
- UModEventViewSubjectRepoRef value
- TResult repoStrongRef(
- UModEventViewSubjectRepoStrongRef value
- TResult messageRef(
- UModEventViewSubjectMessageRef value
- TResult unknown(
- UModEventViewSubjectUnknown 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( UModEventViewSubjectRepoRef value)? repoRef,TResult Function( UModEventViewSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UModEventViewSubjectMessageRef value)? messageRef,TResult Function( UModEventViewSubjectUnknown value)? unknown,required TResult orElse(),}){
final _that = this;
switch (_that) {
case UModEventViewSubjectRepoRef() when repoRef != null:
return repoRef(_that);case UModEventViewSubjectRepoStrongRef() when repoStrongRef != null:
return repoStrongRef(_that);case UModEventViewSubjectMessageRef() when messageRef != null:
return messageRef(_that);case UModEventViewSubjectUnknown() when unknown != null:
return unknown(_that);case _:
return orElse();
}
}