mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? implicit(
- _OAuthFlowImplicit value
- TResult? password(
- _OAuthFlowPassword value
- TResult? clientCredentials(
- _OAuthFlowClientCredentials value
- TResult? authorizationCode(
- _OAuthFlowAuthorizationCode 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( _OAuthFlowImplicit value)? implicit,TResult? Function( _OAuthFlowPassword value)? password,TResult? Function( _OAuthFlowClientCredentials value)? clientCredentials,TResult? Function( _OAuthFlowAuthorizationCode value)? authorizationCode,}){
final _that = this;
switch (_that) {
case _OAuthFlowImplicit() when implicit != null:
return implicit(_that);case _OAuthFlowPassword() when password != null:
return password(_that);case _OAuthFlowClientCredentials() when clientCredentials != null:
return clientCredentials(_that);case _OAuthFlowAuthorizationCode() when authorizationCode != null:
return authorizationCode(_that);case _:
return null;
}
}