whenOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? $default(
- String id,
- String object,
- String? application,
- String? attachToSelf,
- SetupIntentCancellationReason? cancellationReason,
- String clientSecret,
- int? created,
- String? customer,
- String? description,
- List<
SetupIntentFlowDirections> ? flowDirections, - dynamic lastSetupError,
- String? latestAttempt,
- bool livemode,
- String? mandate,
- Map<
String, dynamic> metadata, - dynamic nextAction,
- String? onBehalfOf,
- String? paymentMethod,
- dynamic paymentMethodOptions,
- List<
PaymentMethodType> paymentMethodTypes, - String? singleUseMandate,
- SetupIntentsStatus status,
- SetupIntentUsage usage,
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, String? application, @JsonKey(name: "attach_to_self") String? attachToSelf, @JsonKey(name: "cancellation_reason") SetupIntentCancellationReason? cancellationReason, @JsonKey(name: "client_secret") String clientSecret, int? created, String? customer, String? description, @JsonKey(name: "flow_directions") List<SetupIntentFlowDirections>? flowDirections, @JsonKey(name: "last_setup_error") dynamic lastSetupError, @JsonKey(name: "latest_attempt") String? latestAttempt, bool livemode, String? mandate, 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") dynamic paymentMethodOptions, @JsonKey(name: "payment_method_types") List<PaymentMethodType> paymentMethodTypes, @JsonKey(name: "single_use_mandate") String? singleUseMandate, SetupIntentsStatus status, SetupIntentUsage usage)? $default,) {final _that = this;
switch (_that) {
case _SetupIntent() when $default != null:
return $default(_that.id,_that.object,_that.application,_that.attachToSelf,_that.cancellationReason,_that.clientSecret,_that.created,_that.customer,_that.description,_that.flowDirections,_that.lastSetupError,_that.latestAttempt,_that.livemode,_that.mandate,_that.metadata,_that.nextAction,_that.onBehalfOf,_that.paymentMethod,_that.paymentMethodOptions,_that.paymentMethodTypes,_that.singleUseMandate,_that.status,_that.usage);case _:
return null;
}
}