when<TResult extends Object?>  method 
- @optionalTypeArgs
- TResult $default(- PaymentElementShowTerms? applePay,
- PaymentElementShowTerms? auBecsDebit,
- PaymentElementShowTerms? bancontact,
- PaymentElementShowTerms? card,
- PaymentElementShowTerms? cashApp,
- PaymentElementShowTerms? googlePay,
- PaymentElementShowTerms? ideal,
- PaymentElementShowTerms? payPal,
- PaymentElementShowTerms? sepaDebit,
- PaymentElementShowTerms? sofort,
- PaymentElementShowTerms? usBankAccount,
 
A switch-like method, using callbacks.
As opposed to map, this offers destructuring.
It is equivalent to doing:
switch (sealedClass) {
  case Subclass(:final field):
    return ...;
  case Subclass2(:final field2):
    return ...;
}
Implementation
@optionalTypeArgs TResult when<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,) {final _that = this;
switch (_that) {
case _PaymentElementOptionsTerms():
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 _:
  throw StateError('Unexpected subclass');
}
}