preparePaywallForDisplay static method

Future<PreparePaywallResult> preparePaywallForDisplay({
  1. String? developerPaywallId,
  2. bool backgroundImageRequired = false,
  3. int? imageFetchTimeout,
})

Prepare paywall for display before calling raisePaywall. This method ensure that all data is available for the paywall before displaying it

Optionally you can provide,

  • A developerPaywallId if you want to prepare a specific paywall before raising it.
  • An optional bool for backgroundImageRequired to force whether background image is required to display paywall or not. By default it is false. If passed as true then sdk would try to re-fetch the background image and invoke callback based on image availability
  • An optional timeout value for above image fetching operation

Implementation

static Future<PreparePaywallResult> preparePaywallForDisplay(
    {String? developerPaywallId,
    bool backgroundImageRequired = false,
    int? imageFetchTimeout}) async {
  var variableMap = {
    "developerPaywallId": developerPaywallId,
    "backgroundImageRequired": backgroundImageRequired,
    "imageFetchTimeout": imageFetchTimeout,
  };
  Map<dynamic, dynamic> result =
      await channel.invokeMethod("preparePaywallForDisplay", variableMap);
  var error = (result['error'] as String?)._toPreparePaywallError();
  return PreparePaywallResult(result['success'], error);
}