buildResponseStr method

String buildResponseStr(
  1. Response response,
  2. Map<String, String> headers
)

Implementation

String buildResponseStr(Response<dynamic> response,Map<String,String> headers) {
  String? contentType = contentType2(response.headers.map);
  if(isStr(contentType)){
    dynamic data =  response.data;
   // debugPrint("response : "+ data.toString());
    if (data == null){
      return "response null";
    }
    if(data is Map){
      return json.encode(data);
    }else if(data is List){
      return json.encode(data);
    }
    return data.toString();
  }
  headers["content-type-real"] = contentType.toString().replaceAll("[", "").replaceAll("]", "");
  headers["content-type"] = "text/plain";

  return "not text--> "+ contentType.toString();
}