map<TResult extends Object?> method
- @optionalTypeArgs
- required TResult implicit(
- _OAuthFlowImplicit value
- required TResult password(
- _OAuthFlowPassword value
- required TResult clientCredentials(
- _OAuthFlowClientCredentials value
- required TResult authorizationCode(
- _OAuthFlowAuthorizationCode value
A switch-like method, using callbacks.
Callbacks receives the raw object, upcasted. It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case final Subclass2 value:
return ...;
}
Implementation
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _OAuthFlowImplicit value) implicit,required TResult Function( _OAuthFlowPassword value) password,required TResult Function( _OAuthFlowClientCredentials value) clientCredentials,required TResult Function( _OAuthFlowAuthorizationCode value) authorizationCode,}){
final _that = this;
switch (_that) {
case _OAuthFlowImplicit():
return implicit(_that);case _OAuthFlowPassword():
return password(_that);case _OAuthFlowClientCredentials():
return clientCredentials(_that);case _OAuthFlowAuthorizationCode():
return authorizationCode(_that);case _:
throw StateError('Unexpected subclass');
}
}