mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? relationship(
- UGraphGetRelationshipsRelationshipsRelationship value
- TResult? notFoundActor(
- UGraphGetRelationshipsRelationshipsNotFoundActor value
- TResult? unknown(
- UGraphGetRelationshipsRelationshipsUnknown 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( UGraphGetRelationshipsRelationshipsRelationship value)? relationship,TResult? Function( UGraphGetRelationshipsRelationshipsNotFoundActor value)? notFoundActor,TResult? Function( UGraphGetRelationshipsRelationshipsUnknown value)? unknown,}){
final _that = this;
switch (_that) {
case UGraphGetRelationshipsRelationshipsRelationship() when relationship != null:
return relationship(_that);case UGraphGetRelationshipsRelationshipsNotFoundActor() when notFoundActor != null:
return notFoundActor(_that);case UGraphGetRelationshipsRelationshipsUnknown() when unknown != null:
return unknown(_that);case _:
return null;
}
}