i am using Multipart Request in which i post image after that i get response of video.mp4 but i dont know how to get this response i tried
response.stream.bytetoString() //which give me formatexception which is unexpected byte
i dont know how to get this file and download and play it in my flutter app here is code:
Uri uri = Uri.parse(HttpLinks.localUrl);
var stream = ByteStream(image.openRead());
stream.cast();
var length = await image.length();
// here is path of image is uploading
var request = MultipartRequest('POST', uri)
..files.add(
MultipartFile(
'file1',
stream,
length,
filename:image.path,
// contentType: MediaType('image',"jpg/png"),
),
);
var response = await request.send();// here i get response
if (response.statusCode == 200) {
print('quick response is ${await response.stream.bytesToString()}');
// here is i get exception which is
FormatException: Unexpected extension byte (at offset 43)
return await response.stream.bytesToString();
}
kindly guide me what should i do.