Skip to content

Add "base", "final" and "interface" modifiers #920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 73 additions & 46 deletions .github/workflows/dart.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkgs/http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.0

* Requires Dart 3.0 or later.
* Add `base`, `final`, and `interface` modifiers to some classes.

## 0.13.6

* `BrowserClient` throws an exception if `send` is called after `close`.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/http/lib/retry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'http.dart';
/// NOTE: [RetryClient] makes a copy of the request data in order to support
/// resending it. This can cause a lot of memory usage when sending a large
/// [StreamedRequest].
class RetryClient extends BaseClient {
final class RetryClient extends BaseClient {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface is identical to client. There is no reason to implement or extend this.

/// The wrapped client.
final Client _inner;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/http/lib/src/base_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'streamed_response.dart';
///
/// This is a mixin-style class; subclasses only need to implement [send] and
/// maybe [close], and then they get various convenience methods for free.
abstract class BaseClient implements Client {
abstract mixin class BaseClient implements Client {
@override
Future<Response> head(Uri url, {Map<String, String>? headers}) =>
_sendUnstreamed('HEAD', url, headers);
Expand Down
2 changes: 1 addition & 1 deletion pkgs/http/lib/src/byte_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'dart:convert';
import 'dart:typed_data';

/// A stream of chunks of bytes representing a single piece of data.
class ByteStream extends StreamView<List<int>> {
final class ByteStream extends StreamView<List<int>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This class should not need to exist. It should just be extension methods on Stream<List<int>>.)

const ByteStream(super.stream);

/// Returns a single-subscription byte stream that will emit the given bytes
Expand Down
2 changes: 1 addition & 1 deletion pkgs/http/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import 'streamed_response.dart';
/// extend [BaseClient] rather than [Client]. In most cases, you can wrap
/// another instance of [Client] and add functionality on top of that. This
/// allows all classes implementing [Client] to be mutually composable.
abstract class Client {
abstract interface class Client {
/// Creates a new platform appropriate client.
///
/// Creates an `IOClient` if `dart:io` is available and a `BrowserClient` if
Expand Down
2 changes: 1 addition & 1 deletion pkgs/http/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A composable, multi-platform, Future-based API for HTTP requests.
repository: https://github.com/dart-lang/http/tree/master/pkgs/http

environment:
sdk: '>=2.19.0 <3.0.0'
sdk: '>=3.0.0-417.4.beta <4.0.0'

dependencies:
async: ^2.5.0
Expand Down
2 changes: 1 addition & 1 deletion tool/ci.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.