map<TResult extends Object?> method

  1. @optionalTypeArgs
TResult map<TResult extends Object?>({
  1. required TResult googlePay(
    1. PlatformPayPaymentMethodParamsGooglePay value
    ),
  2. required TResult applePay(
    1. PlatformPayPaymentMethodParamsApplePay value
    ),
  3. required TResult web(
    1. PlatformPayPaymentMethodParamsWeb value
    ),
})

A switch-like method, using callbacks.

Callbacks receives the raw object, upcasted. It is equivalent to doing:

switch (sealedClass) {
  case final Subclass value:
    return ...;
  case final Subclass2 value:
    return ...;
}

Implementation

@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( PlatformPayPaymentMethodParamsGooglePay value)  googlePay,required TResult Function( PlatformPayPaymentMethodParamsApplePay value)  applePay,required TResult Function( PlatformPayPaymentMethodParamsWeb value)  web,}){
final _that = this;
switch (_that) {
case PlatformPayPaymentMethodParamsGooglePay():
return googlePay(_that);case PlatformPayPaymentMethodParamsApplePay():
return applePay(_that);case PlatformPayPaymentMethodParamsWeb():
return web(_that);}
}