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>? platformProducts = await _billingClient.getPlatformProducts(linkFiveResponse);
  if (platformProducts != null) {
    return _store.onNewPlatformProduct(platformProducts);
  }
  return null;
}