multipartRequest method
Future<Response>
multipartRequest(
- Uri uri, {
- List<
MultipartFile> ? files, - Map<
String, String> ? headers, - String method = 'POST',
- Duration? timeout,
override
Implementation
@override
Future<Response> multipartRequest(
Uri uri, {
List<MultipartFile>? files,
Map<String, String>? headers,
String method = 'POST',
Duration? timeout,
}) async {
final request = MultipartRequest(method, uri);
if (files != null) {
request.files.addAll(files);
}
if (headers != null) {
request.headers.addAll(headers);
}
return Response.fromStream(await oauthClient.send(request))
.timeout(timeout ?? defaultTimeout)
.then((response) {
if (response.statusCode >= 200 && response.statusCode < 300) {
return response;
} else {
return Future.error(response);
}
});
}