@@ -10,6 +10,7 @@ import 'dart:typed_data';
1010
1111import 'src/client.dart' ;
1212import 'src/exception.dart' ;
13+ import 'src/progress.dart' ;
1314import 'src/request.dart' ;
1415import 'src/response.dart' ;
1516import 'src/streamed_request.dart' ;
@@ -22,6 +23,8 @@ export 'src/client.dart' hide zoneClient;
2223export 'src/exception.dart' ;
2324export 'src/multipart_file.dart' ;
2425export 'src/multipart_request.dart' ;
26+ export 'src/progress.dart'
27+ hide addTransfer, getProgressTransformer, setLength, setTransferred;
2528export 'src/request.dart' ;
2629export 'src/response.dart' ;
2730export 'src/streamed_request.dart' ;
@@ -44,8 +47,10 @@ Future<Response> head(Uri url, {Map<String, String>? headers}) =>
4447/// the same server, you should use a single [Client] for all of those requests.
4548///
4649/// For more fine-grained control over the request, use [Request] instead.
47- Future <Response > get (Uri url, {Map <String , String >? headers}) =>
48- _withClient ((client) => client.get (url, headers: headers));
50+ Future <Response > get (Uri url,
51+ {Map <String , String >? headers, HttpProgress ? downloadProgress}) =>
52+ _withClient ((client) =>
53+ client.get (url, headers: headers, downloadProgress: downloadProgress));
4954
5055/// Sends an HTTP POST request with the given headers and body to the given URL.
5156///
@@ -66,9 +71,17 @@ Future<Response> get(Uri url, {Map<String, String>? headers}) =>
6671/// For more fine-grained control over the request, use [Request] or
6772/// [StreamedRequest] instead.
6873Future <Response > post (Uri url,
69- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
70- _withClient ((client) =>
71- client.post (url, headers: headers, body: body, encoding: encoding));
74+ {Map <String , String >? headers,
75+ Object ? body,
76+ Encoding ? encoding,
77+ HttpProgress ? downloadProgress,
78+ HttpProgress ? uploadProgress}) =>
79+ _withClient ((client) => client.post (url,
80+ headers: headers,
81+ body: body,
82+ encoding: encoding,
83+ downloadProgress: downloadProgress,
84+ uploadProgress: uploadProgress));
7285
7386/// Sends an HTTP PUT request with the given headers and body to the given URL.
7487///
@@ -89,9 +102,17 @@ Future<Response> post(Uri url,
89102/// For more fine-grained control over the request, use [Request] or
90103/// [StreamedRequest] instead.
91104Future <Response > put (Uri url,
92- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
93- _withClient ((client) =>
94- client.put (url, headers: headers, body: body, encoding: encoding));
105+ {Map <String , String >? headers,
106+ Object ? body,
107+ Encoding ? encoding,
108+ HttpProgress ? downloadProgress,
109+ HttpProgress ? uploadProgress}) =>
110+ _withClient ((client) => client.put (url,
111+ headers: headers,
112+ body: body,
113+ encoding: encoding,
114+ downloadProgress: downloadProgress,
115+ uploadProgress: uploadProgress));
95116
96117/// Sends an HTTP PATCH request with the given headers and body to the given
97118/// URL.
@@ -113,9 +134,17 @@ Future<Response> put(Uri url,
113134/// For more fine-grained control over the request, use [Request] or
114135/// [StreamedRequest] instead.
115136Future <Response > patch (Uri url,
116- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
117- _withClient ((client) =>
118- client.patch (url, headers: headers, body: body, encoding: encoding));
137+ {Map <String , String >? headers,
138+ Object ? body,
139+ Encoding ? encoding,
140+ HttpProgress ? downloadProgress,
141+ HttpProgress ? uploadProgress}) =>
142+ _withClient ((client) => client.patch (url,
143+ headers: headers,
144+ body: body,
145+ encoding: encoding,
146+ downloadProgress: downloadProgress,
147+ uploadProgress: uploadProgress));
119148
120149/// Sends an HTTP DELETE request with the given headers to the given URL.
121150///
@@ -125,9 +154,17 @@ Future<Response> patch(Uri url,
125154///
126155/// For more fine-grained control over the request, use [Request] instead.
127156Future <Response > delete (Uri url,
128- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
129- _withClient ((client) =>
130- client.delete (url, headers: headers, body: body, encoding: encoding));
157+ {Map <String , String >? headers,
158+ Object ? body,
159+ Encoding ? encoding,
160+ HttpProgress ? downloadProgress,
161+ HttpProgress ? uploadProgress}) =>
162+ _withClient ((client) => client.delete (url,
163+ headers: headers,
164+ body: body,
165+ encoding: encoding,
166+ downloadProgress: downloadProgress,
167+ uploadProgress: uploadProgress));
131168
132169/// Sends an HTTP GET request with the given headers to the given URL and
133170/// returns a Future that completes to the body of the response as a [String] .
@@ -141,8 +178,10 @@ Future<Response> delete(Uri url,
141178///
142179/// For more fine-grained control over the request and response, use [Request]
143180/// instead.
144- Future <String > read (Uri url, {Map <String , String >? headers}) =>
145- _withClient ((client) => client.read (url, headers: headers));
181+ Future <String > read (Uri url,
182+ {Map <String , String >? headers, HttpProgress ? downloadProgress}) =>
183+ _withClient ((client) =>
184+ client.read (url, headers: headers, downloadProgress: downloadProgress));
146185
147186/// Sends an HTTP GET request with the given headers to the given URL and
148187/// returns a Future that completes to the body of the response as a list of
@@ -157,8 +196,10 @@ Future<String> read(Uri url, {Map<String, String>? headers}) =>
157196///
158197/// For more fine-grained control over the request and response, use [Request]
159198/// instead.
160- Future <Uint8List > readBytes (Uri url, {Map <String , String >? headers}) =>
161- _withClient ((client) => client.readBytes (url, headers: headers));
199+ Future <Uint8List > readBytes (Uri url,
200+ {Map <String , String >? headers, HttpProgress ? downloadProgress}) =>
201+ _withClient ((client) => client.readBytes (url,
202+ headers: headers, downloadProgress: downloadProgress));
162203
163204Future <T > _withClient <T >(Future <T > Function (Client ) fn) async {
164205 var client = Client ();
0 commit comments