userCanPay method

Future<bool> userCanPay(
  1. PayProvider provider
)

Determines whether a user can pay with the selected provider.

This method wraps the userCanPay method in the platform interface. It makes sure that the provider exists and is available in the platform running the logic.

Implementation

Future<bool> userCanPay(PayProvider provider) async {
  await throwIfProviderIsNotDefined(provider);
  if (supportedProviders[defaultTargetPlatform]!.contains(provider)) {
    return _payPlatform.userCanPay(_configurations[provider]!);
  }

  return Future.value(false);
}