productFor method
The product store calls productId (with its basePlan, for a
Google Play subscription); null when the app doesn't sell it.
Implementation
FFXProduct? productFor(FFXStore store, String productId, {String? basePlan}) {
for (final product in products) {
final matches = switch (store) {
FFXStore.appStore => product.appStoreId == productId,
FFXStore.googlePlay =>
product.googlePlayId == productId &&
(basePlan == null || product.googlePlayBasePlan == basePlan),
// The pretend store names a product by its item; see checkPretend.
FFXStore.pretend => false,
};
if (matches) return product;
}
return null;
}