whenOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? $default(
- String id,
- String object,
- int amount,
- int? amountCapturable,
- PaymentIntentAmountDetails? amountDetails,
- int? amountReceived,
- String? application,
- int? applicationFeeAmount,
- PaymentIntentAutomaticPaymentMethods? automaticPaymentMethods,
- int? canceledAt,
- PaymentIntentCancellationReason? cancellationReason,
- String clientSecret,
- PaymentIntentCaptureMethod captureMethod,
- PaymentIntentConfirmationMethod confirmationMethod,
- int? created,
- String currency,
- String? customer,
- String? description,
- String? invoice,
- StripeError? lastPaymentError,
- String? latestCharge,
- bool livemode,
- Map<
String, dynamic> metadata, - dynamic nextAction,
- String? onBehalfOf,
- String? paymentMethod,
- Map paymentMethodOptions,
- List<
PaymentMethodType> paymentMethodTypes, - dynamic processing,
- String? receiptEmail,
- String? review,
- PaymentIntentSetupFutureUsage? setupFutureUsage,
- ShippingDetails? shipping,
- String? statementDescriptor,
- String? statementDescriptorSuffix,
- PaymentIntentsStatus status,
- dynamic transferData,
- dynamic transferGroup,
A variant of when
that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String object, int amount, @JsonKey(name: "amount_capturable") int? amountCapturable, @JsonKey(name: "amount_details") PaymentIntentAmountDetails? amountDetails, @JsonKey(name: "amount_received") int? amountReceived, String? application, @JsonKey(name: "application_fee_amount") int? applicationFeeAmount, @JsonKey(name: "automatic_payment_methods") PaymentIntentAutomaticPaymentMethods? automaticPaymentMethods, @JsonKey(name: "canceled_at") int? canceledAt, @JsonKey(name: "cancellation_reason") PaymentIntentCancellationReason? cancellationReason, @JsonKey(name: "client_secret") String clientSecret, @JsonKey(name: "capture_method") PaymentIntentCaptureMethod captureMethod, @JsonKey(name: "confirmation_method") PaymentIntentConfirmationMethod confirmationMethod, int? created, String currency, String? customer, String? description, String? invoice, @JsonKey(name: "last_payment_error") StripeError? lastPaymentError, @JsonKey(name: "latest_charge") String? latestCharge, bool livemode, Map<String, dynamic> metadata, @JsonKey(name: "next_action") dynamic nextAction, @JsonKey(name: "on_behalf_of") String? onBehalfOf, @JsonKey(name: "payment_method") String? paymentMethod, @JsonKey(name: "payment_method_options") Map<dynamic, dynamic> paymentMethodOptions, @JsonKey(name: "payment_method_types", unknownEnumValue: PaymentMethodType.unknown) List<PaymentMethodType> paymentMethodTypes, dynamic processing, @JsonKey(name: "receipt_email") String? receiptEmail, String? review, @JsonKey(name: "setup_future_usage") PaymentIntentSetupFutureUsage? setupFutureUsage, ShippingDetails? shipping, @JsonKey(name: "statement_descriptor") String? statementDescriptor, @JsonKey(name: "statement_descriptor_suffix") String? statementDescriptorSuffix, PaymentIntentsStatus status, @JsonKey(name: "transfer_data") dynamic transferData, @JsonKey(name: "transfer_group") dynamic transferGroup)? $default,) {final _that = this;
switch (_that) {
case _PaymentIntent() when $default != null:
return $default(_that.id,_that.object,_that.amount,_that.amountCapturable,_that.amountDetails,_that.amountReceived,_that.application,_that.applicationFeeAmount,_that.automaticPaymentMethods,_that.canceledAt,_that.cancellationReason,_that.clientSecret,_that.captureMethod,_that.confirmationMethod,_that.created,_that.currency,_that.customer,_that.description,_that.invoice,_that.lastPaymentError,_that.latestCharge,_that.livemode,_that.metadata,_that.nextAction,_that.onBehalfOf,_that.paymentMethod,_that.paymentMethodOptions,_that.paymentMethodTypes,_that.processing,_that.receiptEmail,_that.review,_that.setupFutureUsage,_that.shipping,_that.statementDescriptor,_that.statementDescriptorSuffix,_that.status,_that.transferData,_that.transferGroup);case _:
return null;
}
}