A robust Flutter demonstration project showcasing the integration of Adapty.io for in-app subscriptions and paywalls. This project serves as a reference implementation for handling purchases, premium status management, and environment setup in a clean architecture.
- Adapty Integration: Complete implementation of Adapty SDK using a dedicated
AdaptyManagerservice. - StoreKit Testing: configured with a local
.storekitfile for easy iOS subscription testing without a real Sandbox account. - State Management: Uses
ValueNotifierfor reactive premium status updates. - Dependency Injection: Clean service location using
get_it. - Local Storage: Persists user data locally using
hive. - Environment Security: API keys managed securely using
envied. - Unit Testing: Comprehensive tests for the
AdaptyManagerlogic.
You can find a preview video of the application in the assets folder:
assets/app_preview.mp4
- Framework: Flutter
- In-App Purchases: adapty_flutter
- DI: get_it
- Storage: hive
- Secrets: envied
- Testing: mockito
lib/
├── component/ # UI widgets (Paywalls, Cards, BottomSheets)
├── env/ # Environment configuration (Envied)
├── model/ # Data models (Note, UserProfile)
├── page/ # Application screens
├── service_and_managers/ # Core business logic
│ ├── adapty_manager.dart # Main Adapty wrapper service
│ └── ...
├── locator.dart # DI setup
└── main.dart # Entry point
- Flutter SDK ^3.9.0
-
Clone the repository:
git clone https://github.com/yourusername/adptydemo.git cd adptydemo -
Install dependencies:
flutter pub get
-
Generate Environment Variables: This project uses
enviedto hide sensitive keys. You need to create your.envfile inassets/env/(referenced inlib/env/dev_env.dart) and then run the generator:dart run build_runner build -d
-
Run the App:
flutter run
This project is configured to use a local StoreKit configuration file for testing in-app purchases on the iOS Simulator.
- Open
ios/Runner.xcworkspacein Xcode. - The project uses
ios/Runner/Thixq Adapty Demo.storekit. - To enable it:
- Go to Product > Scheme > Edit Scheme.
- Select Run on the left sidebar.
- Under the Options tab, set StoreKit Configuration to
Thixq Adapty Demo.
This allows you to simulate purchase flows, renewals, and cancellations directly on the simulator without connecting to App Store Connect.
Unit tests are included for the core logic, specifically the AdaptyManager.
To run the tests:
flutter testThis project is open source and available under the MIT License.