http
http copied to clipboard
multipart request does not provide the correct progress
final http.StreamedResponse response = await _client.send(request);
int currProgress = 0;
response.stream.listen((value) {
currProgress += value.length;
print(currProgress / contentLength);
});
_client.send(request) awaits for the upload to finish and then after that it provides the StreamedResponse which has a stream but is of no use because the upload is finished and the stream is over,
Whereas using request.finalize() gives an active stream but finishes quickly (within a second) even when the upload is not complete.
Can anyone please have a look into this or correct me if I am doing something wrong, Thanks.