when<TResult extends Object?> method

  1. @optionalTypeArgs
TResult when<TResult extends Object?>(
  1. TResult $default(
    1. String? issuer,
    2. String? authorizationEndpoint,
    3. String? tokenEndpoint,
    4. String? deviceAuthorizationEndpoint,
    5. String? userinfoEndpoint,
    6. String? mfaChallengeEndpoint,
    7. String? jwksUri,
    8. String? registrationEndpoint,
    9. String? revocationEndpoint,
    10. List<String>? scopesSupported,
    11. List<String>? responseTypesSupported,
    12. List<String>? codeChallengeMethodsSupported,
    13. List<String>? responseModesSupported,
    14. List<String>? subjectTypesSupported,
    15. List<String>? idTokenSigningAlgValuesSupported,
    16. List<String>? tokenEndpointAuthMethodsSupported,
    17. List<String>? claimsSupported,
    18. bool? requestUriParameterSupported,
    19. bool? requestParameterSupported,
    20. List<String>? tokenEndpointAuthSigningAlgValuesSupported,
    )
)

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? issuer, @JsonKey(name: 'authorization_endpoint')  String? authorizationEndpoint, @JsonKey(name: 'token_endpoint')  String? tokenEndpoint, @JsonKey(name: 'device_authorization_endpoint')  String? deviceAuthorizationEndpoint, @JsonKey(name: 'userinfo_endpoint')  String? userinfoEndpoint, @JsonKey(name: 'mfa_challenge_endpoint')  String? mfaChallengeEndpoint, @JsonKey(name: 'jwks_uri')  String? jwksUri, @JsonKey(name: 'registration_endpoint')  String? registrationEndpoint, @JsonKey(name: 'revocation_endpoint')  String? revocationEndpoint, @JsonKey(name: 'scopes_supported')  List<String>? scopesSupported, @JsonKey(name: 'response_types_supported')  List<String>? responseTypesSupported, @JsonKey(name: 'code_challenge_methods_supported')  List<String>? codeChallengeMethodsSupported, @JsonKey(name: 'response_modes_supported')  List<String>? responseModesSupported, @JsonKey(name: 'subject_types_supported')  List<String>? subjectTypesSupported, @JsonKey(name: 'id_token_signing_alg_values_supported')  List<String>? idTokenSigningAlgValuesSupported, @JsonKey(name: 'token_endpoint_auth_methods_supported')  List<String>? tokenEndpointAuthMethodsSupported, @JsonKey(name: 'claims_supported')  List<String>? claimsSupported, @JsonKey(name: 'request_uri_parameter_supported')  bool? requestUriParameterSupported, @JsonKey(name: 'request_parameter_supported')  bool? requestParameterSupported, @JsonKey(name: 'token_endpoint_auth_signing_alg_values_supported')  List<String>? tokenEndpointAuthSigningAlgValuesSupported)  $default,) {final _that = this;
switch (_that) {
case _OpenId():
return $default(_that.issuer,_that.authorizationEndpoint,_that.tokenEndpoint,_that.deviceAuthorizationEndpoint,_that.userinfoEndpoint,_that.mfaChallengeEndpoint,_that.jwksUri,_that.registrationEndpoint,_that.revocationEndpoint,_that.scopesSupported,_that.responseTypesSupported,_that.codeChallengeMethodsSupported,_that.responseModesSupported,_that.subjectTypesSupported,_that.idTokenSigningAlgValuesSupported,_that.tokenEndpointAuthMethodsSupported,_that.claimsSupported,_that.requestUriParameterSupported,_that.requestParameterSupported,_that.tokenEndpointAuthSigningAlgValuesSupported);case _:
  throw StateError('Unexpected subclass');

}
}