when<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- String clientId,
- String applicationType,
- String clientName,
- String clientUri,
- bool dpopBoundAccessTokens,
- List<
String> grantTypes, - @JsonKey.new(name: 'redirect_uris_OLD') List<
String> redirectUrisOLD, - List<
String> redirectUris, - List<
String> responseTypes, - String scope,
- String tokenEndpointAuthMethod,
A switch-like method, using callbacks.
As opposed to map, this offers destructuring.
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case Subclass2(:final field2):
return ...;
}
Implementation
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String clientId, String applicationType, String clientName, String clientUri, bool dpopBoundAccessTokens, List<String> grantTypes, @JsonKey(name: 'redirect_uris_OLD') List<String> redirectUrisOLD, List<String> redirectUris, List<String> responseTypes, String scope, String tokenEndpointAuthMethod) $default,) {final _that = this;
switch (_that) {
case _OAuthClientMetadata():
return $default(_that.clientId,_that.applicationType,_that.clientName,_that.clientUri,_that.dpopBoundAccessTokens,_that.grantTypes,_that.redirectUrisOLD,_that.redirectUris,_that.responseTypes,_that.scope,_that.tokenEndpointAuthMethod);case _:
throw StateError('Unexpected subclass');
}
}