Flutter - Use fallback paywalls
Fallback paywalls are supported by Flutter SDK v2.11 and later.
To maintain a fluid user experience, it is important to set up fallbacks for your paywalls and onboardings. This precaution extends the application's capabilities in case of partial or complete loss of internet connection.
-
If the application cannot access Adapty servers:
It will be able to display a fallback paywall, and access the local onboarding configuration.
-
If the application cannot access the internet:
It will be able to display a fallback paywall. Onboardings include remote content and require an internet connection to function.
Before you follow the steps in this guide, download the fallback configuration files from Adapty.
Configuration
- Add the fallback configuration files to the app’s
assetsdirectory at the project root. - Call the
.setFallbackmethod before you fetch the target paywall or onboarding.
import 'dart:async' show Future;
import 'dart:io' show Platform;
final assetId = Platform.isIOS ? 'assets/ios_fallback.json' : 'assets/android_fallback.json';
try {
await Adapty.setFallback(assetId);
} on AdaptyError catch (adaptyError) {
// handle the error
} catch (e) {
}
Parameters:
| Parameter | Description |
|---|---|
| assetId | Path to the fallback configuration file. |
Want to see a real-world example of how Adapty SDK is integrated into a mobile app? Check out our sample apps, which demonstrate the full setup, including displaying paywalls, making purchases, and other basic functionality.