linkfive_purchases 1.0.0 copy "linkfive_purchases: ^1.0.0" to clipboard
linkfive_purchases: ^1.0.0 copied to clipboard


LinkFive Purchases flutter sdk. This will allow your app to use the LinkFive subscription service.

LinkFive Purchases flutter sdk #

Getting Started #

Initialize the SDK

LinkFivePurchases.init("LinkFive Api Key");

fetch all available subscripton:


Available Subscription Data #

LinkFive uses a stream to pass data to your application. You can either just use the stream or use a StreamBuilder

  stream: LinkFivePurchases.listenOnSubscriptionData(),
  builder: (context, snapshot) {
    if (snapshot.hasData) {
      var subscriptionData =;
      if(subscriptionData != null) {
        // do something
    return Center(child: Text('Loading...'));

Purchase a Subscription #

Just call purchase including the skuDetails

makePurchase(LinkFiveProductDetails linkFiveProductDetails) async {
  await LinkFivePurchases.purchase(linkFiveProductDetails.productDetails);

Get Active Subscription Data #

You will receive the data through the active subscription stream. You can either just use the stream or use a StreamBuilder


/// subscriptionData can be null
void _activeSubscriptionListener(LinkFiveActiveSubscriptionData? subscriptionData) async {
  // active Subscription

Restore Purchases #

All restored subscriptions will be available through the activeSubscription listener


Android Errors #

if you get something like:

e: .../LinkFivePurchasesPlugin.kt: (89, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from .../.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.5.0/29dae2501ca094416d15af0e21470cb634780444/kotlin-stdlib-1.5.0.jar!/kotlin/Unit.class

The SDK uses kotlin v1.5.0. You can change the kotlin version in your android/build.gradle file

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"

Gradle #

The sdk uses Gradle version 6.7.1