fetchProduct method

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

Implementation

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

  //then make instance of ApiConnector by passing instance of ApiConfig
  final connector = ApiConnector(apiConfig);

  //Then configure each request by
  final requestConfig = RequestConfig(
    method: HttpMethod.get,
    path: '/products/16',
  );

  //use sendRequest method to make request to the api
  Map<String, dynamic> fetchedData = await connector.sendRequest(requestConfig);
  return fetchedData;
}