Declare a return value of `Uint8List` in `BytesBuilder` methods (dart-lang/web_socket_channel#58) Part of the rollout of https://github.com/dart-lang/sdk/issues/36900
diff --git a/pkgs/web_socket_channel/CHANGELOG.md b/pkgs/web_socket_channel/CHANGELOG.md index 794f783..5240a85 100644 --- a/pkgs/web_socket_channel/CHANGELOG.md +++ b/pkgs/web_socket_channel/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 1.0.13 + +* Internal changes for consistency with the Dart SDK. + ## 1.0.12 * Allow `stream_channel` version 2.x
diff --git a/pkgs/web_socket_channel/lib/src/copy/bytes_builder.dart b/pkgs/web_socket_channel/lib/src/copy/bytes_builder.dart index fed15ad..f34df48 100644 --- a/pkgs/web_socket_channel/lib/src/copy/bytes_builder.dart +++ b/pkgs/web_socket_channel/lib/src/copy/bytes_builder.dart
@@ -47,12 +47,12 @@ /// /// The list returned is a view of the internal buffer, limited to the /// [length]. - List<int> takeBytes(); + Uint8List takeBytes(); /// Returns a copy of the current contents of the builder. /// /// Leaves the contents of the builder intact. - List<int> toBytes(); + Uint8List toBytes(); /// The number of bytes in the builder. int get length; @@ -124,14 +124,14 @@ _buffer = newBuffer; } - List<int> takeBytes() { + Uint8List takeBytes() { if (_length == 0) return _emptyList; var buffer = Uint8List.view(_buffer.buffer, 0, _length); clear(); return buffer; } - List<int> toBytes() { + Uint8List toBytes() { if (_length == 0) return _emptyList; return Uint8List.fromList(Uint8List.view(_buffer.buffer, 0, _length)); } @@ -179,7 +179,7 @@ _length++; } - List<int> takeBytes() { + Uint8List takeBytes() { if (_length == 0) return _CopyingBytesBuilder._emptyList; if (_chunks.length == 1) { var buffer = _chunks[0]; @@ -196,7 +196,7 @@ return buffer; } - List<int> toBytes() { + Uint8List toBytes() { if (_length == 0) return _CopyingBytesBuilder._emptyList; var buffer = Uint8List(_length); int offset = 0;
diff --git a/pkgs/web_socket_channel/pubspec.yaml b/pkgs/web_socket_channel/pubspec.yaml index f1551c5..b4cdedc 100644 --- a/pkgs/web_socket_channel/pubspec.yaml +++ b/pkgs/web_socket_channel/pubspec.yaml
@@ -1,5 +1,5 @@ name: web_socket_channel -version: 1.0.12 +version: 1.0.13 description: >- StreamChannel wrappers for WebSockets. Provides a cross-platform