querySubscribedProduct static method
Queries a subscribed product in the user's inventory
It queries and finds a PurchaseInfo
(or null if it doesn't find) using provided productId
in the user's subscribed products.
If any error happened during the query flow, it throws a PlatformException with a stack trace. You must handle the error with your logic.
It returns a PurchaseInfo
if this product exists in the user's inventory.
If it doesn't find any, it returns null (That's why PurchaseInfo
is nullable).
Implementation
static Future<PurchaseInfo?> querySubscribedProduct(String productId) async {
try {
return (await getAllSubscribedProducts()).find(productId);
} catch (e) {
return Future.error(e);
}
}