diff --git a/CHANGELOG.md b/CHANGELOG.md index 40a944a..d8719f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +#### 2.3.5 + +* Fix internal use of a cast which fails on Dart 2.0 . + #### 2.3.4 * Bumped maximum Dart SDK version to 2.0.0-dev.infinity diff --git a/lib/src/backends/record_replay/codecs.dart b/lib/src/backends/record_replay/codecs.dart index a974692..9754619 100644 --- a/lib/src/backends/record_replay/codecs.dart +++ b/lib/src/backends/record_replay/codecs.dart @@ -85,6 +85,32 @@ class _GenericEncoder extends Converter { } } +/// A trivial conversion turning a Sink> into a +/// Sink +class _StringSinkWrapper implements Sink { + final Sink> _sink; + _StringSinkWrapper(this._sink); + @override + void add(String s) => _sink.add([s]); + @override + void close() => _sink.close(); +} + +/// An Converter version of the dart:convert LineSplitter (which in +/// 2.0 no longer implements the Converter interface) +class LineSplitterConverter extends Converter> { + final LineSplitter _splitter = const LineSplitter(); + + /// Creates a new [LineSplitterConverter] + const LineSplitterConverter(); + + @override + List convert(String input) => _splitter.convert(input); + @override + StringConversionSink startChunkedConversion(Sink> sink) => + _splitter.startChunkedConversion(new _StringSinkWrapper(sink)); +} + /// Converter that leaves an object untouched. class Passthrough extends Converter { /// Creates a new [Passthrough]. diff --git a/lib/src/backends/record_replay/replay_file.dart b/lib/src/backends/record_replay/replay_file.dart index 9b26a2c..869c72f 100644 --- a/lib/src/backends/record_replay/replay_file.dart +++ b/lib/src/backends/record_replay/replay_file.dart @@ -25,7 +25,7 @@ class ReplayFile extends ReplayFileSystemEntity implements File { Converter reviveRandomAccessFile = new ReviveRandomAccessFile(fileSystem); Converter> lineSplitter = - const LineSplitter() as Converter>; + const LineSplitterConverter(); Converter> blobToLines = blobToString.fuse(lineSplitter); Converter>> blobToByteStream = blobToBytes diff --git a/pubspec.yaml b/pubspec.yaml index d5ab8bc..7484c4b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: file -version: 2.3.4 +version: 2.3.5 authors: - Matan Lurey - Yegor Jbanov