I am doing this:
startUpload(File file) async {
var bytes = await file.readAsBytes();
var base64Img = base64.encode(bytes);
debugPrint(base64Img);
var apiUrl = "MY_URL";
var requestBody = new Map<String, String>();
requestBody["requestType"] = "upload";
requestBody["job_id"] = jobId.toString();
requestBody["picture"] = base64Img;
http.Response response = await http.post(apiUrl, body: requestBody);
}
And I noticed that somehow the length of base64Img
received on the backend is smaller than that generated in the app. When I call base64Img.length
I get 129648 but on the server, I get 66401. Please note that file is actually an image. So when I decode the one from the server, the lower part of the image doesn't display or is distorted somehow.
I am also sending this same data in native Android and there are no issues whatsoever.
So my question is, does dart has a max length limit on the values of request body data and how can I send large data?