maybeMap<TResult extends Object?> method
- @optionalTypeArgs
- TResult mentionRule(
- UDraftThreadgateAllowMentionRule value
- TResult followerRule(
- UDraftThreadgateAllowFollowerRule value
- TResult followingRule(
- UDraftThreadgateAllowFollowingRule value
- TResult listRule(
- UDraftThreadgateAllowListRule value
- TResult unknown(
- UDraftThreadgateAllowUnknown 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( UDraftThreadgateAllowMentionRule value)? mentionRule,TResult Function( UDraftThreadgateAllowFollowerRule value)? followerRule,TResult Function( UDraftThreadgateAllowFollowingRule value)? followingRule,TResult Function( UDraftThreadgateAllowListRule value)? listRule,TResult Function( UDraftThreadgateAllowUnknown value)? unknown,required TResult orElse(),}){
final _that = this;
switch (_that) {
case UDraftThreadgateAllowMentionRule() when mentionRule != null:
return mentionRule(_that);case UDraftThreadgateAllowFollowerRule() when followerRule != null:
return followerRule(_that);case UDraftThreadgateAllowFollowingRule() when followingRule != null:
return followingRule(_that);case UDraftThreadgateAllowListRule() when listRule != null:
return listRule(_that);case UDraftThreadgateAllowUnknown() when unknown != null:
return unknown(_that);case _:
return orElse();
}
}