Skip to content

Commit fc1e1bf

Browse files
authored
Prepare for upcoming change to File.openRead() (flutter#125)
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
1 parent 79eb583 commit fc1e1bf

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/file/lib/src/forwarding/forwarding_file.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ abstract class ForwardingFile
7272
delegate.openSync(mode: mode);
7373

7474
@override
75-
Stream<Uint8List> openRead([int start, int end]) =>
76-
delegate.openRead(start, end).transform(const _ToUint8List());
75+
Stream<Uint8List> openRead([int start, int end]) => delegate
76+
.openRead(start, end)
77+
.cast<List<int>>()
78+
.transform(const _ToUint8List());
7779

7880
@override
7981
IOSink openWrite({

packages/file/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: file
2-
version: 5.0.8
2+
version: 5.0.8+1
33
authors:
44
- Matan Lurey <[email protected]>
55
- Yegor Jbanov <[email protected]>

0 commit comments

Comments
 (0)