maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- @JsonKey.new(name: r'$ref') String? ref,
- String? name,
- @JsonKey.new(name: 'in') ParameterLocation? location,
- String? description,
- bool? required,
- bool? deprecated,
- Schema? schema,
- String? type,
- String? format,
- String? collectionFormat,
- Schema? items,
- num? maximum,
- num? minimum,
- bool? explode,
- dynamic example,
- 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(@JsonKey(name: r'$ref') String? ref, String? name, @JsonKey(name: 'in') ParameterLocation? location, String? description, bool? required, bool? deprecated, Schema? schema, String? type, String? format, String? collectionFormat, Schema? items, num? maximum, num? minimum, bool? explode, dynamic example)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Parameter() when $default != null:
return $default(_that.ref,_that.name,_that.location,_that.description,_that.required,_that.deprecated,_that.schema,_that.type,_that.format,_that.collectionFormat,_that.items,_that.maximum,_that.minimum,_that.explode,_that.example);case _:
return orElse();
}
}