createWebPaywallUrl method

Future<String> createWebPaywallUrl({
  1. AdaptyFlowPaywall? paywall,
  2. AdaptyPaywallProduct? product,
})

Implementation

Future<String> createWebPaywallUrl({
  AdaptyFlowPaywall? paywall,
  AdaptyPaywallProduct? product,
}) async {
  Map<String, dynamic>? arguments;

  if (paywall != null) {
    arguments = {Argument.paywall: paywall.jsonValue};
  } else if (product != null) {
    arguments = {Argument.product: product.jsonValue};
  } else {
    throw AdaptyError(
      'Either paywall or product parameter must be provided',
      AdaptyErrorCode.wrongParam,
      null,
    );
  }

  return _invokeMethod<String>(
    Method.createWebPaywallUrl,
    (data) => data as String,
    arguments,
  );
}