Skip to content

Commit 55dedc9

Browse files
tvolkertgoto-bus-stop
authored andcommitted
Prepare for Uint8List SDK breaking change (#13)
* Prepare for Uint8List SDK breaking change A recent change to the Dart SDK updated `HttpClientResponse` to implement `Stream<Uint8List>` rather than implementing `Stream<List<int>>`. This forwards-compatible chnage updates calls to `Stream.transform(StreamTransformer)` to instead call the functionally equivalent `StreamTransformer.bind(Stream)` API, which puts the stream in a covariant position and thus causes the SDK change to be non-breaking. dart-lang/sdk#36900 * Fix typo
1 parent 6ea6afc commit 55dedc9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/event_source.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ class EventSource {
131131
// One or both of "done" and "error" events can trigger. Ensure reconnect
132132
// is only called once per connection.
133133
var reconnectOnce = _onceFunc(_reconnect);
134-
response
135-
.cast<List<int>>()
136-
.transform(utf8.decoder)
134+
utf8.decoder
135+
.bind(response)
137136
.transform(LineSplitter())
138137
.listen(_onMessage, onDone: reconnectOnce, onError: (_) {
139138
reconnectOnce();

0 commit comments

Comments
 (0)