requestAndroidProducts static method

Future<AWResponseModel<List<AWProduct>>> requestAndroidProducts(
  1. String productType,
  2. List<String> products
)

请求安卓的商品信息

Implementation

static Future<AWResponseModel<List<AWProduct>>> requestAndroidProducts(
    String productType, List<String> products) async {
  var result = await _channel.invokeMethod(
      'requestProducts', {"productType": productType, "products": products});
  final model = getResponseModel(result);
  if (!model.result) {
    return AWResponseModel.sendFailed(model.msg);
  }
  //开始对安卓的数据进行解析
  final List<AWProduct> productList = [];
  if (model.data == null) {
    return AWResponseModel.sendSuccess(productList);
  }
  final List productsStr = model.data;
  for (var productJson in productsStr) {
    productList.add(AWProduct.fromAndroidJson(productJson));
  }
  return AWResponseModel.sendSuccess(productList);
}