when<TResult extends Object?> method
TResult
when<TResult extends Object?>({
- required TResult googlePay(
- GooglePayParams googlePayParams,
- GooglePayPaymentMethodParams googlePayPaymentMethodParams
- required TResult applePay(
- ApplePayParams applePayParams
- required TResult web(),
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?>({required TResult Function( GooglePayParams googlePayParams, GooglePayPaymentMethodParams googlePayPaymentMethodParams) googlePay,required TResult Function( ApplePayParams applePayParams) applePay,required TResult Function( PlatformPayWebPaymentRequestCreateOptions options) web,}) {final _that = this;
switch (_that) {
case PlatformPayPaymentMethodParamsGooglePay():
return googlePay(_that.googlePayParams,_that.googlePayPaymentMethodParams);case PlatformPayPaymentMethodParamsApplePay():
return applePay(_that.applePayParams);case PlatformPayPaymentMethodParamsWeb():
return web(_that.options);}
}