createProduct method

Future<Map<String, dynamic>> createProduct()

Implementation

Future<Map<String, dynamic>> createProduct() async {

  final connector = ApiConnector(apiConfig);
  final requestConfig = RequestConfig(
    method: HttpMethod.post,
    path: '/products/',
    //add the data in body that you want to post
    body: {
      "title": "New Test Product",
      "price": 199,
      "description": "This is a test product",
      "categoryId": 1,
      "images": [
        "https://placeimg.com/640/480/any"
      ]
    },
  );

  final response = await connector.sendRequest(requestConfig);
  return response;
}