LinkFive Provider Plugin
It wraps linkfive_purchases in an easy to use provider.
Please read our Blogpost Subscriptions in Flutter - The Complete Implementation Guide
or LinkFive Provider Example Documentation
Register the Provider
Register the Provider with our API key and you're all set to use it.
MultiProvider(
providers: [
// ...
ChangeNotifierProvider(
create: (context) => LinkFiveProvider("API_KEY"),
lazy: false,
),
]
)
Load Products
Whenever you want to offer your product, call fetchProducts()
to load the latest products.
Use the products in your UI:
Consumer<LinkFiveProvider>(builder: (_, linkFiveProvider, __) {
// linkFiveProvider.products if you want to show your subscription offer
// linkFiveProvider.activeProducts if a user purchased a subscription
}
or access in a button tap or in a stateful widget
LinkFiveProvider linkFiveProvider = Provider.of<LinkFiveProvider>(context, listen: false);
That‘s it. Simple enough?
Libraries
- linkfive_purchases_provider
- The Library is made by LinkFive - Flutter Subscription Management https://www.linkfive.io/
- provider/linkfive_provider