@@ -25,30 +25,27 @@ export 'src/response.dart';
25
25
export 'src/streamed_request.dart' ;
26
26
export 'src/streamed_response.dart' ;
27
27
28
- /// Sends an HTTP HEAD request with the given headers to the given URL, which
29
- /// can be a [Uri] or a [String] .
28
+ /// Sends an HTTP HEAD request with the given headers to the given URL.
30
29
///
31
30
/// This automatically initializes a new [Client] and closes that client once
32
31
/// the request is complete. If you're planning on making multiple requests to
33
32
/// the same server, you should use a single [Client] for all of those requests.
34
33
///
35
34
/// For more fine-grained control over the request, use [Request] instead.
36
- Future <Response > head (Object url, {Map <String , String >? headers}) =>
35
+ Future <Response > head (Uri url, {Map <String , String >? headers}) =>
37
36
_withClient ((client) => client.head (url, headers: headers));
38
37
39
- /// Sends an HTTP GET request with the given headers to the given URL, which can
40
- /// be a [Uri] or a [String] .
38
+ /// Sends an HTTP GET request with the given headers to the given URL.
41
39
///
42
40
/// This automatically initializes a new [Client] and closes that client once
43
41
/// the request is complete. If you're planning on making multiple requests to
44
42
/// the same server, you should use a single [Client] for all of those requests.
45
43
///
46
44
/// For more fine-grained control over the request, use [Request] instead.
47
- Future <Response > get (Object url, {Map <String , String >? headers}) =>
45
+ Future <Response > get (Uri url, {Map <String , String >? headers}) =>
48
46
_withClient ((client) => client.get (url, headers: headers));
49
47
50
- /// Sends an HTTP POST request with the given headers and body to the given URL,
51
- /// which can be a [Uri] or a [String] .
48
+ /// Sends an HTTP POST request with the given headers and body to the given URL.
52
49
///
53
50
/// [body] sets the body of the request. It can be a [String] , a [List<int>] or
54
51
/// a [Map<String, String>] . If it's a String, it's encoded using [encoding] and
@@ -66,13 +63,12 @@ Future<Response> get(Object url, {Map<String, String>? headers}) =>
66
63
///
67
64
/// For more fine-grained control over the request, use [Request] or
68
65
/// [StreamedRequest] instead.
69
- Future <Response > post (Object url,
66
+ Future <Response > post (Uri url,
70
67
{Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
71
68
_withClient ((client) =>
72
69
client.post (url, headers: headers, body: body, encoding: encoding));
73
70
74
- /// Sends an HTTP PUT request with the given headers and body to the given URL,
75
- /// which can be a [Uri] or a [String] .
71
+ /// Sends an HTTP PUT request with the given headers and body to the given URL.
76
72
///
77
73
/// [body] sets the body of the request. It can be a [String] , a [List<int>] or
78
74
/// a [Map<String, String>] . If it's a String, it's encoded using [encoding] and
@@ -90,13 +86,13 @@ Future<Response> post(Object url,
90
86
///
91
87
/// For more fine-grained control over the request, use [Request] or
92
88
/// [StreamedRequest] instead.
93
- Future <Response > put (Object url,
89
+ Future <Response > put (Uri url,
94
90
{Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
95
91
_withClient ((client) =>
96
92
client.put (url, headers: headers, body: body, encoding: encoding));
97
93
98
94
/// Sends an HTTP PATCH request with the given headers and body to the given
99
- /// URL, which can be a [Uri] or a [String] .
95
+ /// URL.
100
96
///
101
97
/// [body] sets the body of the request. It can be a [String] , a [List<int>] or
102
98
/// a [Map<String, String>] . If it's a String, it's encoded using [encoding] and
@@ -114,27 +110,25 @@ Future<Response> put(Object url,
114
110
///
115
111
/// For more fine-grained control over the request, use [Request] or
116
112
/// [StreamedRequest] instead.
117
- Future <Response > patch (Object url,
113
+ Future <Response > patch (Uri url,
118
114
{Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
119
115
_withClient ((client) =>
120
116
client.patch (url, headers: headers, body: body, encoding: encoding));
121
117
122
- /// Sends an HTTP DELETE request with the given headers to the given URL, which
123
- /// can be a [Uri] or a [String] .
118
+ /// Sends an HTTP DELETE request with the given headers to the given URL.
124
119
///
125
120
/// This automatically initializes a new [Client] and closes that client once
126
121
/// the request is complete. If you're planning on making multiple requests to
127
122
/// the same server, you should use a single [Client] for all of those requests.
128
123
///
129
124
/// For more fine-grained control over the request, use [Request] instead.
130
- Future <Response > delete (Object url,
125
+ Future <Response > delete (Uri url,
131
126
{Map <String , String >? headers, Object ? body, Encoding ? encoding}) =>
132
127
_withClient ((client) =>
133
128
client.delete (url, headers: headers, body: body, encoding: encoding));
134
129
135
- /// Sends an HTTP GET request with the given headers to the given URL, which can
136
- /// be a [Uri] or a [String] , and returns a Future that completes to the body of
137
- /// the response as a [String] .
130
+ /// Sends an HTTP GET request with the given headers to the given URL and
131
+ /// returns a Future that completes to the body of the response as a [String] .
138
132
///
139
133
/// The Future will emit a [ClientException] if the response doesn't have a
140
134
/// success status code.
@@ -145,12 +139,12 @@ Future<Response> delete(Object url,
145
139
///
146
140
/// For more fine-grained control over the request and response, use [Request]
147
141
/// instead.
148
- Future <String > read (Object url, {Map <String , String >? headers}) =>
142
+ Future <String > read (Uri url, {Map <String , String >? headers}) =>
149
143
_withClient ((client) => client.read (url, headers: headers));
150
144
151
- /// Sends an HTTP GET request with the given headers to the given URL, which can
152
- /// be a [Uri] or a [String] , and returns a Future that completes to the body of
153
- /// the response as a list of bytes.
145
+ /// Sends an HTTP GET request with the given headers to the given URL and
146
+ /// returns a Future that completes to the body of the response as a list of
147
+ /// bytes.
154
148
///
155
149
/// The Future will emit a [ClientException] if the response doesn't have a
156
150
/// success status code.
@@ -161,7 +155,7 @@ Future<String> read(Object url, {Map<String, String>? headers}) =>
161
155
///
162
156
/// For more fine-grained control over the request and response, use [Request]
163
157
/// instead.
164
- Future <Uint8List > readBytes (Object url, {Map <String , String >? headers}) =>
158
+ Future <Uint8List > readBytes (Uri url, {Map <String , String >? headers}) =>
165
159
_withClient ((client) => client.readBytes (url, headers: headers));
166
160
167
161
Future <T > _withClient <T >(Future <T > Function (Client ) fn) async {
0 commit comments