maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. PaymentElementShowTerms? applePay,
    2. PaymentElementShowTerms? auBecsDebit,
    3. PaymentElementShowTerms? bancontact,
    4. PaymentElementShowTerms? card,
    5. PaymentElementShowTerms? cashApp,
    6. PaymentElementShowTerms? googlePay,
    7. PaymentElementShowTerms? ideal,
    8. PaymentElementShowTerms? payPal,
    9. PaymentElementShowTerms? sepaDebit,
    10. PaymentElementShowTerms? sofort,
    11. PaymentElementShowTerms? usBankAccount,
    )?, {
  2. 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( PaymentElementShowTerms? applePay,  PaymentElementShowTerms? auBecsDebit,  PaymentElementShowTerms? bancontact,  PaymentElementShowTerms? card,  PaymentElementShowTerms? cashApp,  PaymentElementShowTerms? googlePay,  PaymentElementShowTerms? ideal,  PaymentElementShowTerms? payPal,  PaymentElementShowTerms? sepaDebit,  PaymentElementShowTerms? sofort,  PaymentElementShowTerms? usBankAccount)?  $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PaymentElementOptionsTerms() when $default != null:
return $default(_that.applePay,_that.auBecsDebit,_that.bancontact,_that.card,_that.cashApp,_that.googlePay,_that.ideal,_that.payPal,_that.sepaDebit,_that.sofort,_that.usBankAccount);case _:
  return orElse();

}
}