linkfive_purchases_provider 3.0.1 linkfive_purchases_provider: ^3.0.1 copied to clipboard
linkfive_purchases wrapped in an easy to use Provider. Register the provider and use linkfive everywhere.
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?