fetchProducts method

Future<LinkFiveProducts?> fetchProducts()

Fetches the subscriptions from LinkFive and retrieves the IAP from the platform

It also submits the ProductDetails to the LinkFive Stream

@return LinkFiveSubscriptionData or null if no subscriptions found

Implementation

Future<LinkFiveProducts?> fetchProducts() async {
  LinkFiveLogger.d("fetch subscriptions");
  await waitForInit();
  var linkFiveResponse = await _client.fetchLinkFiveResponse();
  _store.onNewResponseData(linkFiveResponse);

  List<ProductDetails>? platformSubscriptions = await _billingClient.getPlatformSubscriptions(linkFiveResponse);
  if (platformSubscriptions != null) {
    return _store.onNewPlatformSubscriptions(platformSubscriptions);
  }
  return null;
}