maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- String country,
- String currency,
- PlatformPayWebPaymentItem total,
- List<
PlatformPayWebPaymentItem> displayItems, - bool requestPayerName,
- bool requestPayerEmail,
- bool requestPayerPhone,
- bool requestShipping,
- List<
PlatformPayWebShippingOption> shippingOptions, - List<
PlatformPayWebWalletType> disableWallets,
- 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 country, String currency, PlatformPayWebPaymentItem total, List<PlatformPayWebPaymentItem> displayItems, bool requestPayerName, bool requestPayerEmail, bool requestPayerPhone, bool requestShipping, List<PlatformPayWebShippingOption> shippingOptions, List<PlatformPayWebWalletType> disableWallets)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PaymentRequestCreateOptions() when $default != null:
return $default(_that.country,_that.currency,_that.total,_that.displayItems,_that.requestPayerName,_that.requestPayerEmail,_that.requestPayerPhone,_that.requestShipping,_that.shippingOptions,_that.disableWallets);case _:
return orElse();
}
}