call method

Future<Response> call(
  1. Map<String, String>? paramValues
)

Implementation

Future<http.Response> call(Map<String, String>? paramValues) async {
  Map<String, String> m = HashMap();
  if (params != null) {
    m.addAll(params!);
  }
  if (paramValues != null) {
    m.addAll(paramValues);
  }
  http.Response res;
  if (method == 'get') {
    Uri _uri = Uri.parse(uri);

    //res = await http.get(Uri.dataFromString(uri, parameters: m));
    res = await http.get(_uri.replace(queryParameters: m));
  } else if (method == 'post') {
    res = await http.post(Uri.dataFromString(uri, parameters: m));
  } else {
    throw Exception(method + ' Method for http is not supported');
  }
  return res;
}