getDirect static method

Future getDirect({
  1. required String url,
  2. Map<String, String> queryParams = const {},
  3. Map<String, String>? headers,
})

Implementation

static Future<dynamic> getDirect({required String url,Map<String, String> queryParams=const {},Map<String, String>? headers}) async {
  dynamic result={"status":"failure","message":"error sending request"};
  try{
    http.Response response = await http.get(
      WebServiceHelper.parseUrl(url,params: queryParams),
      headers: headers,
    );
    _debug(response.body);
    if (response.statusCode != 200 && response.statusCode != 201) {
      _handleError(url: url,response: response);
    }
    else {
      result = response.body;
    }
  }
  on Exception catch(ex,stack){
    _handleException(exception:ex, stackTrace: stack,url:url);
  }
  return result;
}