sendHttpRequest static method

Future<Response> sendHttpRequest(
  1. RequestType type,
  2. String urlString,
  3. Map<String, String> headers,
  4. Object data,
)

Implementation

static Future<Response> sendHttpRequest(RequestType type, String urlString,
    Map<String, String> headers, Object data) async {
  switch (type) {
    case RequestType.Post:
      {
        print("################# Post: $urlString #####################");
        print("################# Body of the post $data #################");
        var url = Uri.parse(urlString);
        var response = await http.post(url, body: data, headers: headers);
        return response;
      }
    case RequestType.Get:
    default:
      return Response('error', 0);
  }
}