post static method

Future post({
  1. required String url,
  2. required Map<String, dynamic> data,
  3. required Map<String, String> headers,
})

Implementation

static Future post({
  required String url,
  required Map<String, dynamic> data,
  required Map<String, String> headers,
}) async {
  var url2 = Uri.parse(url);
  headers.addAll({'Content-Type': 'application/json'});
  http.Response response =
      await http.post(url2, headers: headers, body: jsonEncode(data));

  String data2 = response.body;
  var decodeData = jsonDecode(data2);
  return {'status': response.statusCode, 'data': decodeData};

}