We rely on Pub.dev to distribute our Flutter SDK

Main dependency

flutter pub add purchasely_flutter

Don't forget to change the minimum OS versions to match Purchasely requirements (iOS 11 / Android 21)

// Podfile

...

platform :ios, '11.0'

...
// Edit file android/build.gradle
buildscript {
    ext {
        minSdkVersion = 21 //min version must not be below 21
        compileSdkVersion = 33
        targetSdkVersion = 33
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

Android setup

We do include a store by default in our SDK, with Android you can choose to use Google and/or Huawei and/or Amazon.
See below to add the store you want to use

📘

Versioning

All your dependencies must always be at the same version for example

dependencies:
  purchasely_flutter: ^<<current_version>>
  purchasely_google: ^<<current_version>>
  purchasely_android_player: ^<<current_version>>

Google Play Billing

To add Google as a store, you can use our NPM dependency

flutter pub add purchasely_google

Then you must add Google in the list of stores

await Purchasely.start(
        apiKey: '<<X-API-KEY>>',
        androidStores: ['Google'], // default is Google, don't forget to add the dependency to the same version
        storeKit1: false, // set to false to use StoreKit2, true to use StoreKit1
);

Video Player

A video player is not provided by default on Android to avoid conflict with another dependency you may have
We provide one in an external dependency that is detected and handled automatically

flutter pub add purchasely_android_player

Other stores

Our Flutter SDK does not contains other stores to avoid unnecessary integrations. You have to specifically declare which stores you want. To add our stores dependencies to your project, you just need to add them to the app/build.gradle file of your android folder in your project. The version must be the same than purchasely main dependency

dependencies {
    //Amazon App Store
    implementation 'io.purchasely:amazon:<<current_version>>'
    
    //Huawei Mobile Services
    implementation 'io.purchasely:huawei-services:<<current_version>>'
}

What’s Next