@@ -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' ;
@@ -23,6 +24,7 @@ export 'src/client.dart' hide zoneClient;
2324export 'src/exception.dart' ;
2425export 'src/multipart_file.dart' ;
2526export 'src/multipart_request.dart' ;
27+ export 'src/progress.dart' ;
2628export 'src/request.dart' ;
2729export 'src/response.dart' ;
2830export 'src/streamed_request.dart' ;
@@ -64,12 +66,25 @@ Future<Response> get(Uri url, {Map<String, String>? headers}) =>
6466///
6567/// [encoding] defaults to [utf8] .
6668///
69+ /// If [onSendProgress] is provided it will be called to indicate
70+ /// the upload progress
71+ ///
6772/// For more fine-grained control over the request, use [Request] or
6873/// [StreamedRequest] instead.
69- Future <Response > post (Uri url,
70- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
71- _withClient ((client) =>
72- client.post (url, headers: headers, body: body, encoding: encoding));
74+ Future <Response > post (
75+ Uri url, {
76+ Map <String , String >? headers,
77+ Object ? body,
78+ Encoding ? encoding,
79+ Progress ? onSendProgress,
80+ }) =>
81+ _withClient ((client) => client.post (
82+ url,
83+ headers: headers,
84+ body: body,
85+ encoding: encoding,
86+ onSendProgress: onSendProgress,
87+ ));
7388
7489/// Sends an HTTP PUT request with the given headers and body to the given URL.
7590///
@@ -87,12 +102,25 @@ Future<Response> post(Uri url,
87102///
88103/// [encoding] defaults to [utf8] .
89104///
105+ /// If [onSendProgress] is provided it will be called to indicate
106+ /// the upload progress
107+ ///
90108/// For more fine-grained control over the request, use [Request] or
91109/// [StreamedRequest] instead.
92- Future <Response > put (Uri url,
93- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
94- _withClient ((client) =>
95- client.put (url, headers: headers, body: body, encoding: encoding));
110+ Future <Response > put (
111+ Uri url, {
112+ Map <String , String >? headers,
113+ Object ? body,
114+ Encoding ? encoding,
115+ Progress ? onSendProgress,
116+ }) =>
117+ _withClient ((client) => client.put (
118+ url,
119+ headers: headers,
120+ body: body,
121+ encoding: encoding,
122+ onSendProgress: onSendProgress,
123+ ));
96124
97125/// Sends an HTTP PATCH request with the given headers and body to the given
98126/// URL.
@@ -111,24 +139,50 @@ Future<Response> put(Uri url,
111139///
112140/// [encoding] defaults to [utf8] .
113141///
142+ /// If [onSendProgress] is provided it will be called to indicate
143+ /// the upload progress
144+ ///
114145/// For more fine-grained control over the request, use [Request] or
115146/// [StreamedRequest] instead.
116- Future <Response > patch (Uri url,
117- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
118- _withClient ((client) =>
119- client.patch (url, headers: headers, body: body, encoding: encoding));
147+ Future <Response > patch (
148+ Uri url, {
149+ Map <String , String >? headers,
150+ Object ? body,
151+ Encoding ? encoding,
152+ Progress ? onSendProgress,
153+ }) =>
154+ _withClient ((client) => client.patch (
155+ url,
156+ headers: headers,
157+ body: body,
158+ encoding: encoding,
159+ onSendProgress: onSendProgress,
160+ ));
120161
121162/// Sends an HTTP DELETE request with the given headers to the given URL.
122163///
123164/// This automatically initializes a new [Client] and closes that client once
124165/// the request is complete. If you're planning on making multiple requests to
125166/// the same server, you should use a single [Client] for all of those requests.
126167///
168+ /// If [onSendProgress] is provided it will be called to indicate
169+ /// the upload progress
170+ ///
127171/// For more fine-grained control over the request, use [Request] instead.
128- Future <Response > delete (Uri url,
129- {Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
130- _withClient ((client) =>
131- client.delete (url, headers: headers, body: body, encoding: encoding));
172+ Future <Response > delete (
173+ Uri url, {
174+ Map <String , String >? headers,
175+ Object ? body,
176+ Encoding ? encoding,
177+ Progress ? onSendProgress,
178+ }) =>
179+ _withClient ((client) => client.delete (
180+ url,
181+ headers: headers,
182+ body: body,
183+ encoding: encoding,
184+ onSendProgress: onSendProgress,
185+ ));
132186
133187/// Sends an HTTP GET request with the given headers to the given URL and
134188/// returns a Future that completes to the body of the response as a [String] .
0 commit comments