getProducts method
Retrieves a list of products from the store on Android
and iOS
.
iOS
also returns subscriptions.
Implementation
Future<List<IAPItem>> getProducts(List<String> productIds) async {
if (_platform.isAndroid) {
dynamic result = await _channel.invokeMethod(
'getProducts',
<String, dynamic>{
'productIds': productIds.toList(),
},
);
return extractItems(result);
} else if (_platform.isIOS) {
dynamic result = await _channel.invokeMethod(
'getItems',
<String, dynamic>{
'skus': productIds.toList(),
},
);
return extractItems(json.encode(result));
}
throw PlatformException(
code: _platform.operatingSystem, message: "platform not supported");
}