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 @@ -127,7 +127,24 @@ class IOClient extends BaseClient {
127
127
ioRequest.headers.set (name, value);
128
128
});
129
129
130
- var response = await stream.pipe (ioRequest) as HttpClientResponse ;
130
+ HttpClientResponse response;
131
+ if (onSendProgress != null ) {
132
+ var loaded = 0 ;
133
+ onSendProgress (loaded, request.contentLength);
134
+
135
+ await ioRequest.addStream (
136
+ stream.map (
137
+ (chunk) {
138
+ loaded += chunk.length;
139
+ onSendProgress (loaded, request.contentLength);
140
+ return chunk;
141
+ },
142
+ ),
143
+ );
144
+ response = await ioRequest.close ();
145
+ } else {
146
+ response = await stream.pipe (ioRequest) as HttpClientResponse ;
147
+ }
131
148
132
149
var headers = < String , String > {};
133
150
response.headers.forEach ((key, values) {
You can’t perform that action at this time.
0 commit comments