maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- int id,
- @JsonKey.new(name: 'commercial_id') int commercialId,
- @JsonKey.new(name: 'isibook_spaces_id') int isibookSpacesId,
- List<
int> extras, - @JsonKey.new(name: 'payment_type') IsibookPaymentType paymentType,
- @JsonKey.new(name: 'electronic_confirmed') dynamic electronicConfirmed,
- @JsonKey.new(name: 'amount_payed') num amountPayed,
- int customers,
- @JsonKey.new(name: 'reservation_id') int reservationId,
- @JsonKey.new(name: 'account_id') int accountId,
- @JsonKey.new(name: 'account_temp') dynamic accountTemp,
- @JsonKey.new(name: 'created_at') @TimestampConverter() Jiffy createdAt,
- @JsonKey.new(name: 'updated_at') @TimestampConverter() Jiffy updatedAt,
- @JsonKey.new(name: 'datetime_first_slot') @TimestampConverter() Jiffy datetimeFirstSlot,
- @JsonKey.new(name: 'datetime_last_slot') @TimestampConverter() Jiffy datetimeLastSlot,
- @JsonKey.new(name: 'cancel_at') @TimestampConverter() Jiffy? cancelAt,
- @JsonKey.new(name: 'cancel_by') String? cancelBy,
- @JsonKey.new(name: 'isibook_space_activity_id') int? isibookSpaceActivityId,
- @JsonKey.new(name: 'isibook_space_activity_connected_id') int? isibookSpaceActivityConnectedId,
- @JsonKey.new(name: 'recover_code_fattura') String? recoverCodeFattura,
- @JsonKey.new(name: 'error_fattura') String? errorFattura,
- @JsonKey.new(name: 'need_fattura') bool needFattura,
- @JsonKey.new(name: 'backoffice') bool backoffice,
- String? note,
- 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(
int id,
@JsonKey(name: 'commercial_id') int commercialId,
@JsonKey(name: 'isibook_spaces_id') int isibookSpacesId,
List<int> extras,
@JsonKey(name: 'payment_type') IsibookPaymentType paymentType,
@JsonKey(name: 'electronic_confirmed') dynamic electronicConfirmed,
@JsonKey(name: 'amount_payed') num amountPayed,
int customers,
@JsonKey(name: 'reservation_id') int reservationId,
@JsonKey(name: 'account_id') int accountId,
@JsonKey(name: 'account_temp') dynamic accountTemp,
@JsonKey(name: 'created_at') @TimestampConverter() Jiffy createdAt,
@JsonKey(name: 'updated_at') @TimestampConverter() Jiffy updatedAt,
@JsonKey(name: 'datetime_first_slot')
@TimestampConverter()
Jiffy datetimeFirstSlot,
@JsonKey(name: 'datetime_last_slot')
@TimestampConverter()
Jiffy datetimeLastSlot,
@JsonKey(name: 'cancel_at') @TimestampConverter() Jiffy? cancelAt,
@JsonKey(name: 'cancel_by') String? cancelBy,
@JsonKey(name: 'isibook_space_activity_id')
int? isibookSpaceActivityId,
@JsonKey(name: 'isibook_space_activity_connected_id')
int? isibookSpaceActivityConnectedId,
@JsonKey(name: 'recover_code_fattura') String? recoverCodeFattura,
@JsonKey(name: 'error_fattura') String? errorFattura,
@JsonKey(name: 'need_fattura') bool needFattura,
@JsonKey(name: 'backoffice') bool backoffice,
String? note)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _IsibookReservation() when $default != null:
return $default(
_that.id,
_that.commercialId,
_that.isibookSpacesId,
_that.extras,
_that.paymentType,
_that.electronicConfirmed,
_that.amountPayed,
_that.customers,
_that.reservationId,
_that.accountId,
_that.accountTemp,
_that.createdAt,
_that.updatedAt,
_that.datetimeFirstSlot,
_that.datetimeLastSlot,
_that.cancelAt,
_that.cancelBy,
_that.isibookSpaceActivityId,
_that.isibookSpaceActivityConnectedId,
_that.recoverCodeFattura,
_that.errorFattura,
_that.needFattura,
_that.backoffice,
_that.note);
case _:
return orElse();
}
}