mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? repoRef(
- UModerationCreateReportSubjectRepoRef value
- TResult? repoStrongRef(
- UModerationCreateReportSubjectRepoStrongRef value
- TResult? unknown(
- UModerationCreateReportSubjectUnknown 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( UModerationCreateReportSubjectRepoRef value)? repoRef,TResult? Function( UModerationCreateReportSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UModerationCreateReportSubjectUnknown value)? unknown,}){
final _that = this;
switch (_that) {
case UModerationCreateReportSubjectRepoRef() when repoRef != null:
return repoRef(_that);case UModerationCreateReportSubjectRepoStrongRef() when repoStrongRef != null:
return repoStrongRef(_that);case UModerationCreateReportSubjectUnknown() when unknown != null:
return unknown(_that);case _:
return null;
}
}