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.
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
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.2
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|1.0.4||Mar 3, 2019|
|1.0.3||Feb 18, 2019|
|1.0.2||Feb 18, 2019|
|1.0.1||Feb 18, 2019|
|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 May 8, 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 have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
lib/revenuecat.dart. (-0.50 points)
lib/revenuecat.dart reported 1 hint:
line 2 col 8: Unused import: 'dart:ui'.
The package description is too short. (-20 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Package is pre-v0.1 release. (-10 points)
While nothing is inherently wrong with versions of
0.0.*, it might mean that the author is still experimenting with the general direction of the API.