Skip to main content

In-app purchases

This project supports in-app purchasing for Flutter using the in_app_purchase package. The generated template application provides a mocked version of thein_app_purchase package called purchase_client.

The PurchaseClient class implements InAppPurchase from the in_app_purchase package and uses the same mechanism to expose the purchaseStream:


Stream<List<PurchaseDetails>> get purchaseStream => _purchaseStream.stream;

The products.dart file contains mocked products.

The Dart Frog backend serves a list of available subscription data featuring copy text and price information. To edit the subscription data, change the getSubscriptions() method in your custom news data source. Make sure that the product IDs are the same for both your iOS and Android purchase project, as this information is passed to the platform-agnostic in_app_purchase package.

To use the in_app_purchase package, substitute PurchaseClient in main_development.dart and main_production.dart with the in_app_purchase package implementation.

Then, follow the Getting started section in the in_app_purchase package docs.