maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- String id,
- String object,
- BillingDetails? billingDetails,
- String? customer,
- Map<
String, dynamic> metadata, - bool livemode,
- int? created,
- CardPaymentMethod? card,
- SepaDebit? sepaDebit,
- BacsDebit? bacsDebit,
- AuBecsDebit? auBecsDebit,
- Ideal? ideal,
- Fpx? fpx,
- Upi? upi,
- UsBankAccount? usBankAccount,
- PaymentMethodType type,
- 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, String object, BillingDetails? billingDetails, String? customer, Map<String, dynamic> metadata, bool livemode, int? created, CardPaymentMethod? card, SepaDebit? sepaDebit, BacsDebit? bacsDebit, AuBecsDebit? auBecsDebit, Ideal? ideal, Fpx? fpx, Upi? upi, UsBankAccount? usBankAccount, PaymentMethodType type)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PaymentMethod() when $default != null:
return $default(_that.id,_that.object,_that.billingDetails,_that.customer,_that.metadata,_that.livemode,_that.created,_that.card,_that.sepaDebit,_that.bacsDebit,_that.auBecsDebit,_that.ideal,_that.fpx,_that.upi,_that.usBankAccount,_that.type);case _:
return orElse();
}
}