flutter_store_kit 0.0.1 copy "flutter_store_kit: ^0.0.1" to clipboard
flutter_store_kit: ^0.0.1 copied to clipboard

A Flutter store kit for in-app subscriptions.

FlutterStoreKit Library #

FlutterStoreKit is a Flutter library that provides functionality for managing in-app purchases and subscriptions. This documentation outlines how to use the FlutterStoreKit library in your Flutter app.

Installation #

Add the following to your pubspec.yaml:

yaml
dependencies:
  flutter:
    sdk: flutter
  flutter_store_kit: ^1.0.0

1. Initialize the Store #

Initialize the store with your product IDs:

void main() {
  StoreKit.instance.initialize([
    'subscription_id1',
    'subscription_id2',
    'subscription_id3',
  ]);
}

2. Add Listeners #

Add Pro Status Changed Listener Add a listener for pro status changes:

void _onProStatusChanged() {
  // Update UI based on purchase status
}

StoreKit.instance.addProStatusChangedListener(_onProStatusChanged);

Remove Pro Status Changed Listener Remove a listener for pro status changes:

StoreKit.instance.removeProStatusChangedListener(_onProStatusChanged);

Add Error Listener Add a listener for errors:

void _onError(String error) {
  // Handle error
  print("Error: $error");
}

StoreKit.instance.addErrorListener(_onError);

Remove Error Listener Remove a listener for errors:

StoreKit.instance.removeErrorListener(_onError);

3. Purchases #

Restore Past Purchases Restore past purchases for the user:

await StoreKit.instance.restorePastPurchases(context);

Purchase a Subscription Purchase a subscription item:

await StoreKit.instance.purchaseSubscription(subscriptionItem);

Open Subscription Management Page Open the subscription management page for the user:

await StoreKit.instance.openSubscriptionManagementPage();

Check if Product is Purchased Check if a product has been purchased:

bool purchased = StoreKit.instance.isProductPurchased('product_id');

Get Purchased Product IDs Get a list of purchased product IDs:

List<String> purchasedIds = StoreKit.instance.getPurchasedProductIds();

4. Disposal #

Dispose of the store instance:

StoreKit.instance.dispose();
2
likes
0
points
53
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter store kit for in-app subscriptions.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_inapp_purchase, url_launcher

More

Packages that depend on flutter_store_kit