postAsync method

Future postAsync (String endPoint, Map data)

Implementation

Future<dynamic> postAsync(String endPoint, Map data) async {
  var url = this._getOAuthURL("POST", endPoint);

  var client = new http.Client();
  var request = new http.Request('POST', Uri.parse(url));
  request.headers[HttpHeaders.contentTypeHeader] =
      'application/json; charset=utf-8';
  request.headers[HttpHeaders.cacheControlHeader] = "no-cache";
  request.body = json.encode(data);
  var response =
      await client.send(request).then((res) => res.stream.bytesToString());
  var dataResponse = await json.decode(response);
  return dataResponse;
}