maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult apiKey(
- String name,
- String? description,
- ApiKeyLocation location
- TResult http(
- HttpSecurityScheme scheme,
- String? bearerFormat,
- String? description
- TResult mutualTLS(
- String? description
- TResult oauth2(
- String? description,
- OAuthFlows flows
- TResult openIdConnect()?,
- required TResult orElse(),
A variant of when that fallback to an orElse callback.
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return orElse();
}
Implementation
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( String name, String? description, @JsonKey(name: 'in') ApiKeyLocation location)? apiKey,TResult Function( HttpSecurityScheme scheme, String? bearerFormat, String? description)? http,TResult Function( String? description)? mutualTLS,TResult Function( String? description, OAuthFlows flows)? oauth2,TResult Function( String? description, @JsonKey(name: 'openIdConnectUrl') String url)? openIdConnect,required TResult orElse(),}) {final _that = this;
switch (_that) {
case SecuritySchemeApiKey() when apiKey != null:
return apiKey(_that.name,_that.description,_that.location);case SecuritySchemeHttp() when http != null:
return http(_that.scheme,_that.bearerFormat,_that.description);case SecuritySchemeMutualTLS() when mutualTLS != null:
return mutualTLS(_that.description);case SecuritySchemeOauth2() when oauth2 != null:
return oauth2(_that.description,_that.flows);case SecuritySchemeOpenIdConnect() when openIdConnect != null:
return openIdConnect(_that.description,_that.url);case _:
return orElse();
}
}