maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- bool customFlow,
- String? customerId,
- String? primaryButtonLabel,
- String? customerEphemeralKeySecret,
- String? customerSessionClientSecret,
- String? paymentIntentClientSecret,
- String? setupIntentClientSecret,
- IntentConfiguration? intentConfiguration,
- String? merchantDisplayName,
- PaymentSheetApplePay? applePay,
- @JsonKey.new(toJson: UserInterfaceStyleKey.toJson) ThemeMode? style,
- PaymentSheetGooglePay? googlePay,
- @JsonKey.new(name: 'link') LinkDisplayParams? linkDisplayParams,
- bool allowsDelayedPaymentMethods,
- PaymentSheetAppearance? appearance,
- @JsonKey.new(name: 'defaultBillingDetails') BillingDetails? billingDetails,
- bool? allowsRemovalOfLastSavedPaymentMethod,
- List<
String> ? paymentMethodOrder, - String? returnURL,
- BillingDetailsCollectionConfiguration? billingDetailsCollectionConfiguration,
- String? removeSavedPaymentMethodMessage,
- @JsonKey.new(toJson: _cardBrandListToJson) List<
CardBrand> ? preferredNetworks, - CardBrandAcceptance? cardBrandAcceptance,
- CardFundingFiltering? cardFundingFiltering,
- CustomPaymentMethodConfiguration? customPaymentMethodConfiguration,
- bool? opensCardScannerAutomatically,
- @JsonKey.new(toJson: _termsDisplayToJson, fromJson: _termsDisplayFromJson) Map<
String, TermsDisplay> ? termsDisplay,
- 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( bool customFlow, String? customerId, String? primaryButtonLabel, String? customerEphemeralKeySecret, String? customerSessionClientSecret, String? paymentIntentClientSecret, String? setupIntentClientSecret, IntentConfiguration? intentConfiguration, String? merchantDisplayName, PaymentSheetApplePay? applePay, @JsonKey(toJson: UserInterfaceStyleKey.toJson) ThemeMode? style, PaymentSheetGooglePay? googlePay, @JsonKey(name: 'link') LinkDisplayParams? linkDisplayParams, bool allowsDelayedPaymentMethods, PaymentSheetAppearance? appearance, @JsonKey(name: 'defaultBillingDetails') BillingDetails? billingDetails, bool? allowsRemovalOfLastSavedPaymentMethod, List<String>? paymentMethodOrder, String? returnURL, BillingDetailsCollectionConfiguration? billingDetailsCollectionConfiguration, String? removeSavedPaymentMethodMessage, @JsonKey(toJson: _cardBrandListToJson) List<CardBrand>? preferredNetworks, CardBrandAcceptance? cardBrandAcceptance, CardFundingFiltering? cardFundingFiltering, CustomPaymentMethodConfiguration? customPaymentMethodConfiguration, bool? opensCardScannerAutomatically, @JsonKey(toJson: _termsDisplayToJson, fromJson: _termsDisplayFromJson) Map<String, TermsDisplay>? termsDisplay)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SetupParameters() when $default != null:
return $default(_that.customFlow,_that.customerId,_that.primaryButtonLabel,_that.customerEphemeralKeySecret,_that.customerSessionClientSecret,_that.paymentIntentClientSecret,_that.setupIntentClientSecret,_that.intentConfiguration,_that.merchantDisplayName,_that.applePay,_that.style,_that.googlePay,_that.linkDisplayParams,_that.allowsDelayedPaymentMethods,_that.appearance,_that.billingDetails,_that.allowsRemovalOfLastSavedPaymentMethod,_that.paymentMethodOrder,_that.returnURL,_that.billingDetailsCollectionConfiguration,_that.removeSavedPaymentMethodMessage,_that.preferredNetworks,_that.cardBrandAcceptance,_that.cardFundingFiltering,_that.customPaymentMethodConfiguration,_that.opensCardScannerAutomatically,_that.termsDisplay);case _:
return orElse();
}
}