map<TResult extends Object?> method

  1. @optionalTypeArgs
TResult map<TResult extends Object?>({
  1. required TResult implicit(
    1. _OAuthFlowImplicit value
    ),
  2. required TResult password(
    1. _OAuthFlowPassword value
    ),
  3. required TResult clientCredentials(
    1. _OAuthFlowClientCredentials value
    ),
  4. required TResult authorizationCode(
    1. _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');

}
}