getProductDetails method

Future<ProductDetails?> getProductDetails(
  1. String productId
)

Implementation

Future<ProductDetails?> getProductDetails(String productId) async {
  if (_isStoreAvailable && isInitialized) {
    try {
      return retry<ProductDetails?>(
        task: () async => _iapService!.queryProductDetails(productId),
        taskTimeout: kFastAsyncTimeout,
        maxAttempts: 2,
      );
    } catch (error, stackTrace) {
      _logger.error(
        'Error fetching product details for product ID: $productId - $error',
        stackTrace,
      );

      return null;
    }
  } else {
    _logger.warning('Store is not available or not yet initialized.');

    return null;
  }
}