Chromium Code Reviews

Unified Diff: lib/src/utils.dart

Issue 2068363002: pkg/test: Resolve a number of analyzer warnings (Closed) Base URL: https://github.com/dart-lang/test.git@master
Patch Set: fixing usage of LineSplitter Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « lib/src/util/io.dart ('k') | test/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index bc5a2701e9dbe16aff2b2c337f36061191cf9f71..19210f515dff55e034ef78b1932bd547ab0ad118 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -27,8 +27,9 @@ typedef AsyncFunction();
/// A typedef for a zero-argument callback function.
typedef void Callback();
-/// A converter that decodes bytes using UTF-8 and splits them on newlines.
-final lineSplitter = UTF8.decoder.fuse(const LineSplitter());
+/// Transforms the [source] stream of UTF8 bytes into a [Stream] of lines.
+Stream<String> transformUtf8ToLines(Stream<List<int>> source) =>
+ source.transform(UTF8.decoder).transform(const LineSplitter());
nweiz 2016/06/23 21:47:36 You can make this an actual StreamTransformer usin
kevmoo 2016/06/23 21:57:08 Yes, but is there an upside to doing so? Also, I'
nweiz 2016/06/23 22:02:56 The API for using it is nicer and produces less ch
kevmoo 2016/06/23 22:12:24 Done.
/// A regular expression to match the exception prefix that some exceptions'
/// [Object.toString] values contain.
« no previous file with comments | « lib/src/util/io.dart ('k') | test/io.dart » ('j') | no next file with comments »

Powered by Google App Engine