This is not an official RevenueCat repo. We use this plugin at PostMuse and decided to open source it. We welcome contributions of any kind. This implementation uses the native Android and iOS RevenueCat libraries.
Plugin is published on Pub. Add this to your
dependencies: revenuecat: ^0.0.3
flutter packages get
Import it in your dart files
Initialize the plugin
await RevenueCat.setup("YOUR_API_KEY_HERE", null);
If you have user accounts, the second parameter should be the user id. Leaving that
null makes RevenueCat generate ids for you. Read more in the docs
This bit is async. You need to listen for changes to the Purchaser Info and find a way to update the app UI to reflect locked/unlocked features.
RevenueCat.addPurchaseListener(purchaseListener); RevenueCat.addPurchaserInfoUpdateListener(purchaserListener); RevenueCat.addRestoreTransactionListener(purchaserListener);
We recommend you do this at the highest level in your app and find a way to propagate this info. We use an InheritedWidget to keep this state and listen for changes in another "blocker" widget that updates when the InheritedWidget changes state. The "blocker" widget blocks access to whatever is below it and shows a "PRO" badge on top. This is approach is simplistic but effective, and works for us.
Bottom line is you need to listen for state changes from RevenueCat. Listener structure is found here.
var entitlements = await RevenueCat.getEntitlements();
Response is a Map with Entitlements, which then contain Offerings, which contain Products. Products contain price, period, introductory price, etc. It's best to look at the models directly to understand more.
Published under MIT License. Read it here
Demonstrates how to use the revenuecat plugin.
For help getting started with Flutter, view our online documentation.
Add this to your package's pubspec.yaml file:
dependencies: revenuecat: ^0.0.3
You can install packages from the command line:
$ flutter packages get
Alternatively, your editor might support
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.0.3||Nov 9, 2018|
|0.0.2||Nov 9, 2018|
|0.0.1||Nov 9, 2018|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
Document public APIs. (-1 points)
54 out of 54 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.
lib/revenuecat.dart. (-0.50 points)
lib/revenuecat.dart reported 1 hint:
line 2 col 8: Unused import: 'dart:ui'.
The description is too short. (-20 points)
Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.
Package is pre-v0.1 release. (-10 points)
While there is nothing inherently wrong with versions of
0.0.*, it usually means that the author is still experimenting with the general direction of the API.