From b16c0fa9afe90e0f98bc25cc1f93062bb7166fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Tue, 17 May 2022 10:41:09 +0200 Subject: [PATCH 1/8] Setup callback for send data progress --- pkgs/http/lib/http.dart | 86 ++++++++++++++++++++++----- pkgs/http/lib/retry.dart | 10 +++- pkgs/http/lib/src/base_client.dart | 85 +++++++++++++++++++++----- pkgs/http/lib/src/base_request.dart | 9 ++- pkgs/http/lib/src/browser_client.dart | 6 +- pkgs/http/lib/src/client.dart | 58 +++++++++++++++--- pkgs/http/lib/src/io_client.dart | 6 +- pkgs/http/lib/src/mock_client.dart | 6 +- pkgs/http/lib/src/progress.dart | 7 +++ 9 files changed, 227 insertions(+), 46 deletions(-) create mode 100644 pkgs/http/lib/src/progress.dart diff --git a/pkgs/http/lib/http.dart b/pkgs/http/lib/http.dart index 317a2c17f3..39e69d2e21 100644 --- a/pkgs/http/lib/http.dart +++ b/pkgs/http/lib/http.dart @@ -10,6 +10,7 @@ import 'dart:typed_data'; import 'src/client.dart'; import 'src/exception.dart'; +import 'src/progress.dart'; import 'src/request.dart'; import 'src/response.dart'; import 'src/streamed_request.dart'; @@ -23,6 +24,7 @@ export 'src/client.dart' hide zoneClient; export 'src/exception.dart'; export 'src/multipart_file.dart'; export 'src/multipart_request.dart'; +export 'src/progress.dart'; export 'src/request.dart'; export 'src/response.dart'; export 'src/streamed_request.dart'; @@ -64,12 +66,25 @@ Future get(Uri url, {Map? headers}) => /// /// [encoding] defaults to [utf8]. /// +/// If [onSendProgress] is provided it will be called to indicate +/// the upload progress +/// /// For more fine-grained control over the request, use [Request] or /// [StreamedRequest] instead. -Future post(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _withClient((client) => - client.post(url, headers: headers, body: body, encoding: encoding)); +Future post( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, +}) => + _withClient((client) => client.post( + url, + headers: headers, + body: body, + encoding: encoding, + onSendProgress: onSendProgress, + )); /// Sends an HTTP PUT request with the given headers and body to the given URL. /// @@ -87,12 +102,25 @@ Future post(Uri url, /// /// [encoding] defaults to [utf8]. /// +/// If [onSendProgress] is provided it will be called to indicate +/// the upload progress +/// /// For more fine-grained control over the request, use [Request] or /// [StreamedRequest] instead. -Future put(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _withClient((client) => - client.put(url, headers: headers, body: body, encoding: encoding)); +Future put( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, +}) => + _withClient((client) => client.put( + url, + headers: headers, + body: body, + encoding: encoding, + onSendProgress: onSendProgress, + )); /// Sends an HTTP PATCH request with the given headers and body to the given /// URL. @@ -111,12 +139,25 @@ Future put(Uri url, /// /// [encoding] defaults to [utf8]. /// +/// If [onSendProgress] is provided it will be called to indicate +/// the upload progress +/// /// For more fine-grained control over the request, use [Request] or /// [StreamedRequest] instead. -Future patch(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _withClient((client) => - client.patch(url, headers: headers, body: body, encoding: encoding)); +Future patch( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, +}) => + _withClient((client) => client.patch( + url, + headers: headers, + body: body, + encoding: encoding, + onSendProgress: onSendProgress, + )); /// Sends an HTTP DELETE request with the given headers to the given URL. /// @@ -124,11 +165,24 @@ Future patch(Uri url, /// the request is complete. If you're planning on making multiple requests to /// the same server, you should use a single [Client] for all of those requests. /// +/// If [onSendProgress] is provided it will be called to indicate +/// the upload progress +/// /// For more fine-grained control over the request, use [Request] instead. -Future delete(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _withClient((client) => - client.delete(url, headers: headers, body: body, encoding: encoding)); +Future delete( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, +}) => + _withClient((client) => client.delete( + url, + headers: headers, + body: body, + encoding: encoding, + onSendProgress: onSendProgress, + )); /// Sends an HTTP GET request with the given headers to the given URL and /// returns a Future that completes to the body of the response as a [String]. diff --git a/pkgs/http/lib/retry.dart b/pkgs/http/lib/retry.dart index dedba9a9e7..2d7936a60c 100644 --- a/pkgs/http/lib/retry.dart +++ b/pkgs/http/lib/retry.dart @@ -105,14 +105,20 @@ final class RetryClient extends BaseClient { ); @override - Future send(BaseRequest request) async { + Future send( + BaseRequest request, { + Progress? onSendProgress, + }) async { final splitter = StreamSplitter(request.finalize()); var i = 0; for (;;) { StreamedResponse? response; try { - response = await _inner.send(_copyRequest(request, splitter.split())); + response = await _inner.send( + _copyRequest(request, splitter.split()), + onSendProgress: onSendProgress, + ); } catch (error, stackTrace) { if (i == _retries || !await _whenError(error, stackTrace)) rethrow; } diff --git a/pkgs/http/lib/src/base_client.dart b/pkgs/http/lib/src/base_client.dart index 48a7f92fe9..378d3bcbda 100644 --- a/pkgs/http/lib/src/base_client.dart +++ b/pkgs/http/lib/src/base_client.dart @@ -9,6 +9,7 @@ import 'base_request.dart'; import 'byte_stream.dart'; import 'client.dart'; import 'exception.dart'; +import 'progress.dart'; import 'request.dart'; import 'response.dart'; import 'streamed_response.dart'; @@ -27,24 +28,72 @@ abstract mixin class BaseClient implements Client { _sendUnstreamed('GET', url, headers); @override - Future post(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _sendUnstreamed('POST', url, headers, body, encoding); + Future post( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }) => + _sendUnstreamed( + 'POST', + url, + headers, + body, + encoding, + onSendProgress, + ); @override - Future put(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _sendUnstreamed('PUT', url, headers, body, encoding); + Future put( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }) => + _sendUnstreamed( + 'PUT', + url, + headers, + body, + encoding, + onSendProgress, + ); @override - Future patch(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _sendUnstreamed('PATCH', url, headers, body, encoding); + Future patch( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }) => + _sendUnstreamed( + 'PATCH', + url, + headers, + body, + encoding, + onSendProgress, + ); @override - Future delete(Uri url, - {Map? headers, Object? body, Encoding? encoding}) => - _sendUnstreamed('DELETE', url, headers, body, encoding); + Future delete( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }) => + _sendUnstreamed( + 'DELETE', + url, + headers, + body, + encoding, + onSendProgress, + ); @override Future read(Uri url, {Map? headers}) async { @@ -68,12 +117,15 @@ abstract mixin class BaseClient implements Client { /// later point, or it could already be closed when it's returned. Any /// internal HTTP errors should be wrapped as [ClientException]s. @override - Future send(BaseRequest request); + Future send( + BaseRequest request, { + Progress? onSendProgress, + }); /// Sends a non-streaming [Request] and returns a non-streaming [Response]. Future _sendUnstreamed( String method, Uri url, Map? headers, - [Object? body, Encoding? encoding]) async { + [Object? body, Encoding? encoding, Progress? onSendProgress]) async { var request = Request(method, url); if (headers != null) request.headers.addAll(headers); @@ -90,7 +142,10 @@ abstract mixin class BaseClient implements Client { } } - return Response.fromStream(await send(request)); + return Response.fromStream(await send( + request, + onSendProgress: onSendProgress, + )); } /// Throws an error if [response] is not successful. diff --git a/pkgs/http/lib/src/base_request.dart b/pkgs/http/lib/src/base_request.dart index 4b165c7587..eb1728fef5 100644 --- a/pkgs/http/lib/src/base_request.dart +++ b/pkgs/http/lib/src/base_request.dart @@ -11,6 +11,7 @@ import 'base_client.dart'; import 'base_response.dart'; import 'byte_stream.dart'; import 'client.dart'; +import 'progress.dart'; import 'streamed_response.dart'; import 'utils.dart'; @@ -27,6 +28,9 @@ abstract class BaseRequest { /// Non-standard method names are also supported. final String method; + /// The callback to call for data send progress. + Progress? onSendProgress; + /// The URL to which the request will be sent. final Uri url; @@ -130,7 +134,10 @@ abstract class BaseRequest { var client = Client(); try { - var response = await client.send(this); + var response = await client.send( + this, + onSendProgress: onSendProgress, + ); var stream = onDone(response.stream, client.close); if (response case BaseResponseWithUrl(:final url)) { diff --git a/pkgs/http/lib/src/browser_client.dart b/pkgs/http/lib/src/browser_client.dart index 6ea112486b..6514650ebd 100644 --- a/pkgs/http/lib/src/browser_client.dart +++ b/pkgs/http/lib/src/browser_client.dart @@ -11,6 +11,7 @@ import 'base_client.dart'; import 'base_request.dart'; import 'byte_stream.dart'; import 'exception.dart'; +import 'progress.dart'; import 'streamed_response.dart'; final _digitRegex = RegExp(r'^\d+$'); @@ -50,7 +51,10 @@ class BrowserClient extends BaseClient { /// Sends an HTTP request and asynchronously returns the response. @override - Future send(BaseRequest request) async { + Future send( + BaseRequest request, + Progress? onSendProgress, + ) async { if (_isClosed) { throw ClientException( 'HTTP request failed. Client is already closed.', request.url); diff --git a/pkgs/http/lib/src/client.dart b/pkgs/http/lib/src/client.dart index 8ee554a241..c598448218 100644 --- a/pkgs/http/lib/src/client.dart +++ b/pkgs/http/lib/src/client.dart @@ -15,6 +15,7 @@ import 'client_stub.dart' if (dart.library.js_interop) 'browser_client.dart' if (dart.library.io) 'io_client.dart'; import 'exception.dart'; +import 'progress.dart'; import 'response.dart'; import 'streamed_response.dart'; @@ -70,9 +71,17 @@ abstract interface class Client { /// /// [encoding] defaults to [utf8]. /// + /// If [onSendProgress] is provided it will be called to indicate + /// the upload progress + /// /// For more fine-grained control over the request, use [send] instead. - Future post(Uri url, - {Map? headers, Object? body, Encoding? encoding}); + Future post( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }); /// Sends an HTTP PUT request with the given headers and body to the given /// URL. @@ -91,9 +100,17 @@ abstract interface class Client { /// /// [encoding] defaults to [utf8]. /// + /// If [onSendProgress] is provided it will be called to indicate + /// the upload progress + /// /// For more fine-grained control over the request, use [send] instead. - Future put(Uri url, - {Map? headers, Object? body, Encoding? encoding}); + Future put( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }); /// Sends an HTTP PATCH request with the given headers and body to the given /// URL. @@ -112,15 +129,31 @@ abstract interface class Client { /// /// [encoding] defaults to [utf8]. /// + /// If [onSendProgress] is provided it will be called to indicate + /// the upload progress + /// /// For more fine-grained control over the request, use [send] instead. - Future patch(Uri url, - {Map? headers, Object? body, Encoding? encoding}); + Future patch( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }); /// Sends an HTTP DELETE request with the given headers to the given URL. /// + /// If [onSendProgress] is provided it will be called to indicate + /// the upload progress + /// /// For more fine-grained control over the request, use [send] instead. - Future delete(Uri url, - {Map? headers, Object? body, Encoding? encoding}); + Future delete( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + Progress? onSendProgress, + }); /// Sends an HTTP GET request with the given headers to the given URL and /// returns a Future that completes to the body of the response as a String. @@ -144,7 +177,14 @@ abstract interface class Client { Future readBytes(Uri url, {Map? headers}); /// Sends an HTTP request and asynchronously returns the response. - Future send(BaseRequest request); + /// + /// If [onSendProgress] is provided it will be called to indicate + /// the upload progress + /// + Future send( + BaseRequest request, { + Progress? onSendProgress, + }); /// Closes the client and cleans up any resources associated with it. /// diff --git a/pkgs/http/lib/src/io_client.dart b/pkgs/http/lib/src/io_client.dart index fe4834bb24..b145803bbb 100644 --- a/pkgs/http/lib/src/io_client.dart +++ b/pkgs/http/lib/src/io_client.dart @@ -10,6 +10,7 @@ import 'base_response.dart'; import 'client.dart'; import 'exception.dart'; import 'io_streamed_response.dart'; +import 'progress.dart'; /// Create an [IOClient]. /// @@ -105,7 +106,10 @@ class IOClient extends BaseClient { /// Sends an HTTP request and asynchronously returns the response. @override - Future send(BaseRequest request) async { + Future send( + BaseRequest request, { + Progress? onSendProgress, + }) async { if (_inner == null) { throw ClientException( 'HTTP request failed. Client is already closed.', request.url); diff --git a/pkgs/http/lib/src/mock_client.dart b/pkgs/http/lib/src/mock_client.dart index 52f108a577..e6976fc9d7 100644 --- a/pkgs/http/lib/src/mock_client.dart +++ b/pkgs/http/lib/src/mock_client.dart @@ -7,6 +7,7 @@ import 'dart:convert'; import 'base_client.dart'; import 'base_request.dart'; import 'byte_stream.dart'; +import 'progress.dart'; import 'request.dart'; import 'response.dart'; import 'streamed_request.dart'; @@ -72,7 +73,10 @@ class MockClient extends BaseClient { }); @override - Future send(BaseRequest request) async { + Future send( + BaseRequest request, { + Progress? onSendProgress, + }) async { var bodyStream = request.finalize(); return await _handler(request, bodyStream); } diff --git a/pkgs/http/lib/src/progress.dart b/pkgs/http/lib/src/progress.dart new file mode 100644 index 0000000000..9326699320 --- /dev/null +++ b/pkgs/http/lib/src/progress.dart @@ -0,0 +1,7 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Callback function for progress data. +/// +typedef Progress = void Function(int? loaded, int? total); From c16bf0250539ee5edf3ff2dd90199a2a01663e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Thu, 27 May 2021 17:19:01 +0200 Subject: [PATCH 2/8] Added send progress to BrowserClient --- pkgs/http/lib/src/browser_client.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/http/lib/src/browser_client.dart b/pkgs/http/lib/src/browser_client.dart index 6514650ebd..613bbf790e 100644 --- a/pkgs/http/lib/src/browser_client.dart +++ b/pkgs/http/lib/src/browser_client.dart @@ -66,6 +66,18 @@ class BrowserClient extends BaseClient { ..open(request.method, '${request.url}', true) ..responseType = 'arraybuffer' ..withCredentials = withCredentials; + + if (onSendProgress != null) { + xhr.upload.addEventListener('progress', (event) { + if (event is ProgressEvent && event.lengthComputable) { + onSendProgress( + event.loaded, + event.total, + ); + } + }); + } + for (var header in request.headers.entries) { xhr.setRequestHeader(header.key, header.value); } From b2d832b2207766e2cbd9e1e9c10e6d0040a0db20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Thu, 27 May 2021 17:19:20 +0200 Subject: [PATCH 3/8] Added send progress to IOClient --- pkgs/http/lib/src/io_client.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pkgs/http/lib/src/io_client.dart b/pkgs/http/lib/src/io_client.dart index b145803bbb..cc4931162d 100644 --- a/pkgs/http/lib/src/io_client.dart +++ b/pkgs/http/lib/src/io_client.dart @@ -127,7 +127,24 @@ class IOClient extends BaseClient { ioRequest.headers.set(name, value); }); - var response = await stream.pipe(ioRequest) as HttpClientResponse; + HttpClientResponse response; + if (onSendProgress != null) { + var loaded = 0; + onSendProgress(loaded, request.contentLength); + + await ioRequest.addStream( + stream.map( + (chunk) { + loaded += chunk.length; + onSendProgress(loaded, request.contentLength); + return chunk; + }, + ), + ); + response = await ioRequest.close(); + } else { + response = await stream.pipe(ioRequest) as HttpClientResponse; + } var headers = {}; response.headers.forEach((key, values) { From 7574756b811b32590dbd02faafc4f670bc55f2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Thu, 27 May 2021 17:26:06 +0200 Subject: [PATCH 4/8] Update changelog --- pkgs/http/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/http/CHANGELOG.md b/pkgs/http/CHANGELOG.md index 18e71333b7..10ebdd6d18 100644 --- a/pkgs/http/CHANGELOG.md +++ b/pkgs/http/CHANGELOG.md @@ -62,6 +62,8 @@ * Throw a more useful error when a client is used after it has been closed. * Require Dart 2.14. +* Add `onSendProgress` callback + ## 0.13.3 * Validate that the `method` parameter of BaseRequest is a valid "token". From e2f0ea60ac7b7b156ca71e56bbaab6a82e99b256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Tue, 17 May 2022 10:44:13 +0200 Subject: [PATCH 5/8] Update changelog --- pkgs/http/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/http/CHANGELOG.md b/pkgs/http/CHANGELOG.md index 10ebdd6d18..decd4d596a 100644 --- a/pkgs/http/CHANGELOG.md +++ b/pkgs/http/CHANGELOG.md @@ -56,14 +56,13 @@ * In `MockHttpClient` use the callback returned `Response.request` instead of the argument value to give more control to the callback. This may be breaking for callbacks which return incomplete Responses and relied on the default. +* Add `onSendProgress` callback ## 0.13.4 * Throw a more useful error when a client is used after it has been closed. * Require Dart 2.14. -* Add `onSendProgress` callback - ## 0.13.3 * Validate that the `method` parameter of BaseRequest is a valid "token". From 2a03dddaabb20659e9ee4135d363c6352a5ac059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Tue, 30 May 2023 11:08:49 +0200 Subject: [PATCH 6/8] Fixed test override --- pkgs/http/test/io/client_test.dart | 10 ++++++++-- pkgs/http/test/io/http_test.dart | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/http/test/io/client_test.dart b/pkgs/http/test/io/client_test.dart index fd426a8b3f..8a5d17ee99 100644 --- a/pkgs/http/test/io/client_test.dart +++ b/pkgs/http/test/io/client_test.dart @@ -17,14 +17,20 @@ import '../utils.dart'; class TestClient extends http.BaseClient { @override - Future send(http.BaseRequest request) { + Future send( + http.BaseRequest request, + http.Progress? onSendProgress, + ) { throw UnimplementedError(); } } class TestClient2 extends http.BaseClient { @override - Future send(http.BaseRequest request) { + Future send( + http.BaseRequest request, + http.Progress? onSendProgress, + ) { throw UnimplementedError(); } } diff --git a/pkgs/http/test/io/http_test.dart b/pkgs/http/test/io/http_test.dart index 3f9aad815e..2465c61daf 100644 --- a/pkgs/http/test/io/http_test.dart +++ b/pkgs/http/test/io/http_test.dart @@ -12,7 +12,10 @@ import '../utils.dart'; class TestClient extends http.BaseClient { @override - Future send(http.BaseRequest request) { + Future send( + http.BaseRequest request, + http.Progress? onSendProgress, + ) { throw UnimplementedError(); } } From 2272c0011ed55a5c26dffe358e6d552515d5ef8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Tue, 30 May 2023 11:11:52 +0200 Subject: [PATCH 7/8] Update changelog --- pkgs/http/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http/CHANGELOG.md b/pkgs/http/CHANGELOG.md index decd4d596a..a1ce0685d5 100644 --- a/pkgs/http/CHANGELOG.md +++ b/pkgs/http/CHANGELOG.md @@ -1,6 +1,7 @@ ## 1.2.3-wip * Fixed unintended HTML tags in doc comments. +* Added `onSendProgress` callback ## 1.2.2 @@ -56,7 +57,6 @@ * In `MockHttpClient` use the callback returned `Response.request` instead of the argument value to give more control to the callback. This may be breaking for callbacks which return incomplete Responses and relied on the default. -* Add `onSendProgress` callback ## 0.13.4 From 30b47e618bcca462924070f75fa9c7ec67759354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCder?= Date: Tue, 30 May 2023 18:27:26 +0200 Subject: [PATCH 8/8] Fixed overrides after rebase --- pkgs/http/lib/src/browser_client.dart | 4 ++-- pkgs/http/test/io/client_test.dart | 8 ++++---- pkgs/http/test/io/http_test.dart | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/http/lib/src/browser_client.dart b/pkgs/http/lib/src/browser_client.dart index 613bbf790e..078dc51f7c 100644 --- a/pkgs/http/lib/src/browser_client.dart +++ b/pkgs/http/lib/src/browser_client.dart @@ -52,9 +52,9 @@ class BrowserClient extends BaseClient { /// Sends an HTTP request and asynchronously returns the response. @override Future send( - BaseRequest request, + BaseRequest request, { Progress? onSendProgress, - ) async { + }) async { if (_isClosed) { throw ClientException( 'HTTP request failed. Client is already closed.', request.url); diff --git a/pkgs/http/test/io/client_test.dart b/pkgs/http/test/io/client_test.dart index 8a5d17ee99..ec581271e8 100644 --- a/pkgs/http/test/io/client_test.dart +++ b/pkgs/http/test/io/client_test.dart @@ -18,9 +18,9 @@ import '../utils.dart'; class TestClient extends http.BaseClient { @override Future send( - http.BaseRequest request, + http.BaseRequest request, { http.Progress? onSendProgress, - ) { + }) { throw UnimplementedError(); } } @@ -28,9 +28,9 @@ class TestClient extends http.BaseClient { class TestClient2 extends http.BaseClient { @override Future send( - http.BaseRequest request, + http.BaseRequest request, { http.Progress? onSendProgress, - ) { + }) { throw UnimplementedError(); } } diff --git a/pkgs/http/test/io/http_test.dart b/pkgs/http/test/io/http_test.dart index 2465c61daf..696f92228b 100644 --- a/pkgs/http/test/io/http_test.dart +++ b/pkgs/http/test/io/http_test.dart @@ -13,9 +13,9 @@ import '../utils.dart'; class TestClient extends http.BaseClient { @override Future send( - http.BaseRequest request, + http.BaseRequest request, { http.Progress? onSendProgress, - ) { + }) { throw UnimplementedError(); } }