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 @@ -110,7 +110,24 @@ class IOClient extends BaseClient {
110110 ioRequest.headers.set (name, value);
111111 });
112112
113- var response = await stream.pipe (ioRequest) as HttpClientResponse ;
113+ HttpClientResponse response;
114+ if (onSendProgress != null ) {
115+ var loaded = 0 ;
116+ onSendProgress (loaded, request.contentLength);
117+
118+ await ioRequest.addStream (
119+ stream.map (
120+ (chunk) {
121+ loaded += chunk.length;
122+ onSendProgress (loaded, request.contentLength);
123+ return chunk;
124+ },
125+ ),
126+ );
127+ response = await ioRequest.close ();
128+ } else {
129+ response = await stream.pipe (ioRequest) as HttpClientResponse ;
130+ }
114131
115132 var headers = < String , String > {};
116133 response.headers.forEach ((key, values) {
You can’t perform that action at this time.
0 commit comments