maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- String id,
- bool ready,
- AvailableShippingRates? availableShippingRates,
- String createdAt,
- String currencyCode,
- PriceV2 totalTaxV2,
- PriceV2 totalPriceV2,
- bool taxesIncluded,
- bool taxExempt,
- PriceV2 subtotalPriceV2,
- bool requiresShipping,
- List<
AppliedGiftCards> appliedGiftCards, - List<
LineItem> lineItems, - Order? order,
- String? orderStatusUrl,
- String? shopifyPaymentsAccountId,
- MailingAddress? shippingAddress,
- ShippingRates? shippingLine,
- String? email,
- String? completedAt,
- String? note,
- String? webUrl,
- String? updatedAt,
- 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( String id, bool ready, AvailableShippingRates? availableShippingRates, String createdAt, String currencyCode, PriceV2 totalTaxV2, PriceV2 totalPriceV2, bool taxesIncluded, bool taxExempt, PriceV2 subtotalPriceV2, bool requiresShipping, List<AppliedGiftCards> appliedGiftCards, @JsonKey(fromJson: JsonHelper.lineItems) List<LineItem> lineItems, Order? order, String? orderStatusUrl, String? shopifyPaymentsAccountId, MailingAddress? shippingAddress, ShippingRates? shippingLine, String? email, String? completedAt, String? note, String? webUrl, String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Checkout() when $default != null:
return $default(_that.id,_that.ready,_that.availableShippingRates,_that.createdAt,_that.currencyCode,_that.totalTaxV2,_that.totalPriceV2,_that.taxesIncluded,_that.taxExempt,_that.subtotalPriceV2,_that.requiresShipping,_that.appliedGiftCards,_that.lineItems,_that.order,_that.orderStatusUrl,_that.shopifyPaymentsAccountId,_that.shippingAddress,_that.shippingLine,_that.email,_that.completedAt,_that.note,_that.webUrl,_that.updatedAt);case _:
return orElse();
}
}