mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? repoRef(
- UReportViewSubjectRepoRef value
- TResult? repoStrongRef(
- UReportViewSubjectRepoStrongRef value
- TResult? messageRef(
- UReportViewSubjectMessageRef value
- TResult? convoRef(
- UReportViewSubjectConvoRef value
- TResult? unknown(
- UReportViewSubjectUnknown 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( UReportViewSubjectRepoRef value)? repoRef,TResult? Function( UReportViewSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UReportViewSubjectMessageRef value)? messageRef,TResult? Function( UReportViewSubjectConvoRef value)? convoRef,TResult? Function( UReportViewSubjectUnknown value)? unknown,}){
final _that = this;
switch (_that) {
case UReportViewSubjectRepoRef() when repoRef != null:
return repoRef(_that);case UReportViewSubjectRepoStrongRef() when repoStrongRef != null:
return repoStrongRef(_that);case UReportViewSubjectMessageRef() when messageRef != null:
return messageRef(_that);case UReportViewSubjectConvoRef() when convoRef != null:
return convoRef(_that);case UReportViewSubjectUnknown() when unknown != null:
return unknown(_that);case _:
return null;
}
}