Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 7b5a488

Browse files
tvolkertnatebosch
authored andcommitted
Declare a return value of Uint8List in BytesBuilder methods (#58)
Part of the rollout of dart-lang/sdk#36900
1 parent aaa5472 commit 7b5a488

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.13
2+
3+
* Internal changes for consistency with the Dart SDK.
4+
15
## 1.0.12
26

37
* Allow `stream_channel` version 2.x

lib/src/copy/bytes_builder.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ abstract class BytesBuilder {
4747
///
4848
/// The list returned is a view of the internal buffer, limited to the
4949
/// [length].
50-
List<int> takeBytes();
50+
Uint8List takeBytes();
5151

5252
/// Returns a copy of the current contents of the builder.
5353
///
5454
/// Leaves the contents of the builder intact.
55-
List<int> toBytes();
55+
Uint8List toBytes();
5656

5757
/// The number of bytes in the builder.
5858
int get length;
@@ -124,14 +124,14 @@ class _CopyingBytesBuilder implements BytesBuilder {
124124
_buffer = newBuffer;
125125
}
126126

127-
List<int> takeBytes() {
127+
Uint8List takeBytes() {
128128
if (_length == 0) return _emptyList;
129129
var buffer = Uint8List.view(_buffer.buffer, 0, _length);
130130
clear();
131131
return buffer;
132132
}
133133

134-
List<int> toBytes() {
134+
Uint8List toBytes() {
135135
if (_length == 0) return _emptyList;
136136
return Uint8List.fromList(Uint8List.view(_buffer.buffer, 0, _length));
137137
}
@@ -179,7 +179,7 @@ class _BytesBuilder implements BytesBuilder {
179179
_length++;
180180
}
181181

182-
List<int> takeBytes() {
182+
Uint8List takeBytes() {
183183
if (_length == 0) return _CopyingBytesBuilder._emptyList;
184184
if (_chunks.length == 1) {
185185
var buffer = _chunks[0];
@@ -196,7 +196,7 @@ class _BytesBuilder implements BytesBuilder {
196196
return buffer;
197197
}
198198

199-
List<int> toBytes() {
199+
Uint8List toBytes() {
200200
if (_length == 0) return _CopyingBytesBuilder._emptyList;
201201
var buffer = Uint8List(_length);
202202
int offset = 0;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: web_socket_channel
2-
version: 1.0.12
2+
version: 1.0.13
33

44
description: >-
55
StreamChannel wrappers for WebSockets. Provides a cross-platform

0 commit comments

Comments
 (0)