whenOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? $default()?
A variant of when that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<String>? tags, String? summary, String? description, ExternalDocs? externalDocs, @JsonKey(name: 'operationId') String? id, List<Parameter>? parameters, RequestBody? requestBody, Map<String, Response>? responses, @_ApiCallbackMapConverter() Map<String, ApiCallback>? callbacks, bool? deprecated, List<Security>? security, List<Server>? servers)? $default,) {final _that = this;
switch (_that) {
case _Operation() when $default != null:
return $default(_that.tags,_that.summary,_that.description,_that.externalDocs,_that.id,_that.parameters,_that.requestBody,_that.responses,_that.callbacks,_that.deprecated,_that.security,_that.servers);case _:
return null;
}
}