File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,24 @@ class IOClient extends BaseClient {
9898 ioRequest.headers.set (name, value);
9999 });
100100
101- var response = await stream.pipe (ioRequest) as HttpClientResponse ;
101+ HttpClientResponse response;
102+ if (onSendProgress != null ) {
103+ var loaded = 0 ;
104+ onSendProgress (loaded, request.contentLength);
105+
106+ await ioRequest.addStream (
107+ stream.map (
108+ (chunk) {
109+ loaded += chunk.length;
110+ onSendProgress (loaded, request.contentLength);
111+ return chunk;
112+ },
113+ ),
114+ );
115+ response = await ioRequest.close ();
116+ } else {
117+ response = await stream.pipe (ioRequest) as HttpClientResponse ;
118+ }
102119
103120 var headers = < String , String > {};
104121 response.headers.forEach ((key, values) {
You can’t perform that action at this time.
0 commit comments