This guide describes how to add and use Apphud SDK to your Flutter app


Please check the guide at pub.dev.

Initialize SDK

To initialize Apphud SDK you will need API Key. It is a unique identifier of your Apphud application. You can get it in your Apphud application settings under General tab

Basic initialization looks like this:

await Apphud.start(apiKey: "apiKey");

Initialization options:







iOS, Android




iOS, Android










You can also initialise SDK with custom Device ID. This should be used if you plan to use logout / login features. This method can also be used for user uniqueness to be by your own User ID. If you purchase IAPs using Apphud SDK, you should pass observerMode as false. You can safely pass the same identifier to Device ID and User ID:

await Apphud.startManually(
apiKey: "apiKey",
userID: "userID",
deviceID: "userID",
observerMode: true,

More information regarding User ID uniqueness and User merging can be found here.

Log out method will clear all saved data and reset SDK to uninitialised state:

await Apphud.logout();

Get Paywalls (version 2.0.6 or above)

To get a paywall use:

await Apphud.getPaywalls()

Purchase using Apphud SDK

To make a purchase call:

await Apphud.purchase(product: product)

Purchase in Observer Mode (Android)

If you use your own billing on Android then you should sync purchases each time user makes any purchase or restoration. Just call after purchase or restore:

await Apphud.syncPurchases();

Keep in mind, that you are responsible for acknowledging or consuming all purchases in observer mode!

Purchase in Observer Mode (iOS)

Apphud SDK automatically intercepts purchases on iOS and passes receipt data to Apphud servers. No additional code required.

Check Subscription Status

await Apphud.hasActiveSubscription();

Returns true if a user has an active subscription. Use this method to determine whether to unlock premium functionality to the user.

Get Products

Please NOTE: the methodApphud.products()has been deprecated. Use Apphud.getPaywallsinstead.

Apphud automatically fetches SKProduct/SkuDetails objects upon launch. Make sure products identifiers are added to Apphud products. To get your products call:

await Apphud.products();

Get Subscription Details

To get the subscription object (which contains an expiration date, autorenewal status, etc.) use the following method:

await Apphud.subscription();

Check Non-renewing Purchase Status

Use this method to check whether the user has purchased an in-app purchase and it's not refunded. Returns false if was never purchased or is refunded.

await Apphud.isNonRenewingPurchaseActive("productIdentifier")

Get Non-renewing Purchase Details

To get non-renewing purchases, which contain purchase date, product identifier and cancellation date, use the following method:

await Apphud.nonRenewingPurchases();

Get User ID

To get user id you can use this method:

await Apphud.userId();


Submit attribution data to Apphud from your attribution network provider.

Map<String,dynamic> data = {"key":"value"};
ApphudAttributionProvider provider = ApphudAttributionProvider.appsFlyer;
await AppHud.addAttribution(data: data, provider: provider);

Restore Purchases

If your app doesn't have a login system, which identifies a premium user by his credentials, then you need a "restore" mechanism.

await Apphud.restorePurchases();

Basically, it just sends App Store Receipt (iOS) or PlayMarket Purchase Tokens (Android) to Apphud and returns subscriptions info (or null, if subscriptions are never purchased), non-renewing purchases (or null, if there are no any), and an optional error.

Migrate existing purchases (Android)

If you need to migrate existing purchases in case you already have a live app or if you need to restore purchases when user hits the Restore button, just call syncPurchases() method.

await Apphud.syncPurchases();

Do not migrate purchases on every app launch. One successful time is enough. Store flag in your app if purchases were successfully migrated.