Skip to content

Commit

Permalink
Prepare for upcoming change to File.openRead() (flutter#125)
Browse files Browse the repository at this point in the history
An upcoming change to the Dart SDK will change the signature
of `File.openRead()` from returning `Stream<List<int>>` to
returning `Stream<Uint8List>`.

This forwards-compatible change prepares for that SDK breaking
change by casting the Stream to `List<int>` before transforming
it.

dart-lang/sdk#36900
  • Loading branch information
tvolkert authored Jun 25, 2019
1 parent 79eb583 commit fc1e1bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/file/lib/src/forwarding/forwarding_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ abstract class ForwardingFile
delegate.openSync(mode: mode);

@override
Stream<Uint8List> openRead([int start, int end]) =>
delegate.openRead(start, end).transform(const _ToUint8List());
Stream<Uint8List> openRead([int start, int end]) => delegate
.openRead(start, end)
.cast<List<int>>()
.transform(const _ToUint8List());

@override
IOSink openWrite({
Expand Down
2 changes: 1 addition & 1 deletion packages/file/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: file
version: 5.0.8
version: 5.0.8+1
authors:
- Matan Lurey <[email protected]>
- Yegor Jbanov <[email protected]>
Expand Down

0 comments on commit fc1e1bf

Please sign in to comment.