@@ -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,7 @@ 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' ;
2527export 'src/request.dart' ;
2628export 'src/response.dart' ;
2729export 'src/streamed_request.dart' ;
@@ -63,12 +65,25 @@ Future<Response> get(Uri url, {Map<String, String>? headers}) =>
6365///
6466/// [encoding] defaults to [utf8] .
6567///
68+ /// If [onSendProgress] is provided it will be called to indicate
69+ /// the upload progress
70+ ///
6671/// For more fine-grained control over the request, use [Request] or
6772/// [StreamedRequest] instead.
68- Future <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));
73+ Future <Response > post (
74+ Uri url, {
75+ Map <String , String >? headers,
76+ Object ? body,
77+ Encoding ? encoding,
78+ Progress ? onSendProgress,
79+ }) =>
80+ _withClient ((client) => client.post (
81+ url,
82+ headers: headers,
83+ body: body,
84+ encoding: encoding,
85+ onSendProgress: onSendProgress,
86+ ));
7287
7388/// Sends an HTTP PUT request with the given headers and body to the given URL.
7489///
@@ -86,12 +101,25 @@ Future<Response> post(Uri url,
86101///
87102/// [encoding] defaults to [utf8] .
88103///
104+ /// If [onSendProgress] is provided it will be called to indicate
105+ /// the upload progress
106+ ///
89107/// For more fine-grained control over the request, use [Request] or
90108/// [StreamedRequest] instead.
91- Future <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));
109+ Future <Response > put (
110+ Uri url, {
111+ Map <String , String >? headers,
112+ Object ? body,
113+ Encoding ? encoding,
114+ Progress ? onSendProgress,
115+ }) =>
116+ _withClient ((client) => client.put (
117+ url,
118+ headers: headers,
119+ body: body,
120+ encoding: encoding,
121+ onSendProgress: onSendProgress,
122+ ));
95123
96124/// Sends an HTTP PATCH request with the given headers and body to the given
97125/// URL.
@@ -110,24 +138,50 @@ Future<Response> put(Uri url,
110138///
111139/// [encoding] defaults to [utf8] .
112140///
141+ /// If [onSendProgress] is provided it will be called to indicate
142+ /// the upload progress
143+ ///
113144/// For more fine-grained control over the request, use [Request] or
114145/// [StreamedRequest] instead.
115- Future <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));
146+ Future <Response > patch (
147+ Uri url, {
148+ Map <String , String >? headers,
149+ Object ? body,
150+ Encoding ? encoding,
151+ Progress ? onSendProgress,
152+ }) =>
153+ _withClient ((client) => client.patch (
154+ url,
155+ headers: headers,
156+ body: body,
157+ encoding: encoding,
158+ onSendProgress: onSendProgress,
159+ ));
119160
120161/// Sends an HTTP DELETE request with the given headers to the given URL.
121162///
122163/// This automatically initializes a new [Client] and closes that client once
123164/// the request is complete. If you're planning on making multiple requests to
124165/// the same server, you should use a single [Client] for all of those requests.
125166///
167+ /// If [onSendProgress] is provided it will be called to indicate
168+ /// the upload progress
169+ ///
126170/// For more fine-grained control over the request, use [Request] instead.
127- Future <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));
171+ Future <Response > delete (
172+ Uri url, {
173+ Map <String , String >? headers,
174+ Object ? body,
175+ Encoding ? encoding,
176+ Progress ? onSendProgress,
177+ }) =>
178+ _withClient ((client) => client.delete (
179+ url,
180+ headers: headers,
181+ body: body,
182+ encoding: encoding,
183+ onSendProgress: onSendProgress,
184+ ));
131185
132186/// Sends an HTTP GET request with the given headers to the given URL and
133187/// returns a Future that completes to the body of the response as a [String] .
0 commit comments