Flutter

Instructions for installing Purchases SDK for Flutter

What is RevenueCat?

RevenueCat provides a backend and a wrapper around StoreKit and Google Play Billing to make implementing in-app purchases and subscriptions easy. With our SDK, you can build and manage your app business on any platform without having to maintain IAP infrastructure. You can read more about how RevenueCat fits into your app or you can sign up free to start building.

Requirements

Xcode 13.3.1+
Minimum target: iOS 11.0+

Installation

To use this plugin, add purchases_flutter as a dependency in your pubspec.yaml file (and run an implicit dart pub get):

dependencies:
  purchases_flutter: ^6.0.0

Alternatively run this command:

 $ flutter pub add purchases_flutter

Amazon Appstore

The latest stable version of the Flutter SDK doesn't have support for the Amazon Appstore. If you would like to use our SDK with the Amazon Appstore, use the version tagged amazon-latest and follow the AMAZON_INSTRUCTIONS.md docs to get set up.

iOS Deployment Target

RevenueCat is compatible with iOS 11.0 or higher. Flutter does not automatically set the iOS deployment target for your project. You need to make sure that the deployment target is set to 11.0 or higher. To do that, simply edit ios/Podfile and add the following line if it's not already there:

platform :ios, '11.0'

Set it to 11.0 or a higher version for RevenueCat to work.

iOS Swift Version

RevenueCat requires Swift >= 5.0 to work. If the Podfile in your project's ios folder specifies a Swift version, make sure that it's at least 5.0, otherwise you may run into build issues.

Import Purchases

You should now be able to import purchases_flutter.

import 'package:purchases_flutter/purchases_flutter.dart';

📘

Enable In-App Purchase capability for iOS projects in Xcode

Don't forget to enable the In-App Purchase capability for your iOS project under Project Target -> Capabilities -> In-App Purchase

🚧

If you're using other plugins like mobx, you may run into conflicts with types from other plugins having the same name as those defined in purchases_flutter.
If this happens, you can resolve the ambiguity in the types by adding an import alias, for example:

import 'package:purchases_flutter/purchases_flutter.dart' as purchases;

After that, you can reference the types from purchases_flutter as purchases.Foo, like purchases.PurchaserInfo.

Next Steps