get static method

Future get({
  1. required String url,
  2. required Map<String, String> headers,
})

Implementation

static Future get({
  required String url,
  required Map<String, String> headers,
}) async {
  var url2 = Uri.parse(url);
  http.Response response = await http.get(
    url2,
    headers: headers,
  );
  try {
    if (response.statusCode == 200) {
      String data = response.body;
      var decodeData = jsonDecode(data);
      return decodeData;
    } else {
      String data = response.body;
      var decodeData = jsonDecode(data);
      return decodeData;
    }
  } catch (e) {
    String data = response.body;
    var decodeData = jsonDecode(data);
    return decodeData;
  }
}