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