diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 288c206..60d99a3 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - sdk: [3.2, dev] + sdk: [3.3, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 diff --git a/CHANGELOG.md b/CHANGELOG.md index d476216..3d75aaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.4.4 + +* Require Dart `^3.3` +* Require `package:web` `^0.5.0`. + ## 2.4.3 - `HtmlWebSocketChannel`: Relax the type of the websocket parameter to the diff --git a/lib/html.dart b/lib/html.dart index 5212e20..a96076f 100644 --- a/lib/html.dart +++ b/lib/html.dart @@ -8,11 +8,10 @@ import 'dart:typed_data'; import 'package:async/async.dart'; import 'package:stream_channel/stream_channel.dart'; -import 'package:web/helpers.dart'; +import 'package:web/web.dart'; import 'src/channel.dart'; import 'src/exception.dart'; -import 'src/web_helpers.dart'; /// A [WebSocketChannel] that communicates using a `dart:html` [WebSocket]. class HtmlWebSocketChannel extends StreamChannelMixin @@ -100,7 +99,7 @@ class HtmlWebSocketChannel extends StreamChannelMixin } // The socket API guarantees that only a single open event will be // emitted. - innerWebSocket.onOpenX.first.then((_) { + innerWebSocket.onOpen.first.then((_) { _readyCompleter.complete(); _listen(); }); @@ -108,7 +107,7 @@ class HtmlWebSocketChannel extends StreamChannelMixin // The socket API guarantees that only a single error event will be emitted, // and that once it is no open or message events will be emitted. - innerWebSocket.onErrorX.first.then((_) { + innerWebSocket.onError.first.then((_) { // Unfortunately, the underlying WebSocket API doesn't expose any // specific information about the error itself. final error = WebSocketChannelException('WebSocket connection failed.'); @@ -119,11 +118,11 @@ class HtmlWebSocketChannel extends StreamChannelMixin _controller.local.sink.close(); }); - innerWebSocket.onMessageX.listen(_innerListen); + innerWebSocket.onMessage.listen(_innerListen); // The socket API guarantees that only a single error event will be emitted, // and that once it is no other events will be emitted. - innerWebSocket.onCloseX.first.then((event) { + innerWebSocket.onClose.first.then((event) { _closeCode = event.code; _closeReason = event.reason; _controller.local.sink.close(); diff --git a/lib/src/web_helpers.dart b/lib/src/web_helpers.dart deleted file mode 100644 index 32b475a..0000000 --- a/lib/src/web_helpers.dart +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2023, 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. - -import 'package:web/helpers.dart'; - -// TODO(kevmoo): remove when https://github.com/dart-lang/web/commit/4cb5811ed06 -// is in a published release and the min constraint on pkg:web is updated -extension WebSocketEvents on WebSocket { - Stream get onOpenX => EventStreamProviders.openEvent.forTarget(this); - Stream get onMessageX => - EventStreamProviders.messageEvent.forTarget(this); - Stream get onCloseX => - EventStreamProviders.closeEvent.forTarget(this); - Stream get onErrorX => - EventStreamProviders.errorEventSourceEvent.forTarget(this); -} diff --git a/pubspec.yaml b/pubspec.yaml index 2f77f96..99301cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: web_socket_channel -version: 2.4.3 +version: 2.4.4 description: >- StreamChannel wrappers for WebSockets. Provides a cross-platform WebSocketChannel API, a cross-platform implementation of that API that @@ -7,13 +7,13 @@ description: >- repository: https://github.com/dart-lang/web_socket_channel environment: - sdk: ^3.2.0 + sdk: ^3.3.0 dependencies: async: ^2.5.0 crypto: ^3.0.0 stream_channel: ^2.1.0 - web: ^0.4.0 + web: ^0.5.0 dev_dependencies: dart_flutter_team_lints: ^2.0.0 diff --git a/test/html_test.dart b/test/html_test.dart index 908e370..98fe43f 100644 --- a/test/html_test.dart +++ b/test/html_test.dart @@ -12,9 +12,8 @@ import 'dart:typed_data'; import 'package:async/async.dart'; import 'package:stream_channel/stream_channel.dart'; import 'package:test/test.dart'; -import 'package:web/helpers.dart' hide BinaryType; +import 'package:web/web.dart' hide BinaryType; import 'package:web_socket_channel/html.dart'; -import 'package:web_socket_channel/src/web_helpers.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; extension on StreamChannel { @@ -70,7 +69,7 @@ void main() { test('communicates using an existing open WebSocket', () async { final webSocket = WebSocket('ws://localhost:$port'); - await webSocket.onOpenX.first; + await webSocket.onOpen.first; final channel = HtmlWebSocketChannel(webSocket);