maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult other(
    1. PaymentProviderOther value
    )?,
  2. TResult smartGlocal(
    1. PaymentProviderSmartGlocal value
    )?,
  3. TResult stripe(
    1. PaymentProviderStripe value
    )?,
  4. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(PaymentProviderOther value)? other,
  TResult Function(PaymentProviderSmartGlocal value)? smartGlocal,
  TResult Function(PaymentProviderStripe value)? stripe,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case PaymentProviderOther.constructor:
      if (other != null) {
        return other.call(this as PaymentProviderOther);
      }
      break;
    case PaymentProviderSmartGlocal.constructor:
      if (smartGlocal != null) {
        return smartGlocal.call(this as PaymentProviderSmartGlocal);
      }
      break;
    case PaymentProviderStripe.constructor:
      if (stripe != null) {
        return stripe.call(this as PaymentProviderStripe);
      }
      break;
  }
  return orElse.call();
}