maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- Map<
String, Schema> ? schemas, - Map<
String, Response> ? responses, - Map<
String, Parameter> ? parameters, - Map<
String, Example> ? examples, - Map<
String, RequestBody> ? requestBodies, - Map<
String, Header> ? headers, - Map<
String, SecurityScheme> ? securitySchemes, - Map<
String, Link> ? links, - Map<
String, ApiCallback> ? callbacks, - Map<
String, PathItem> ? pathItems,
- Map<
- 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(@_SchemaMapConverter() Map<String, Schema>? schemas, Map<String, Response>? responses, Map<String, Parameter>? parameters, Map<String, Example>? examples, Map<String, RequestBody>? requestBodies, Map<String, Header>? headers, Map<String, SecurityScheme>? securitySchemes, Map<String, Link>? links, @_ApiCallbackMapConverter() Map<String, ApiCallback>? callbacks, Map<String, PathItem>? pathItems)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Components() when $default != null:
return $default(_that.schemas,_that.responses,_that.parameters,_that.examples,_that.requestBodies,_that.headers,_that.securitySchemes,_that.links,_that.callbacks,_that.pathItems);case _:
return orElse();
}
}