maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
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? description, bool? required, bool? deprecated, String? style, bool? explode, Schema? schema, dynamic example, Map<String, Example>? examples, Map<String, MediaType>? content, @JsonKey(name: r'$ref') String? ref)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Header() when $default != null:
return $default(_that.description,_that.required,_that.deprecated,_that.style,_that.explode,_that.schema,_that.example,_that.examples,_that.content,_that.ref);case _:
return orElse();
}
}