Document difference between Stream.transform and Stream.map.

Fixes #36351

Bug: http://dartbug.com/36351
Change-Id: I75f98b8fdc3a34578adab96e9993089ea69e84bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98346
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
This commit is contained in:
Lasse R.H. Nielsen 2020-03-06 13:19:34 +00:00 committed by commit-bot@chromium.org
parent b0b8304b87
commit 93ff9530aa
4 changed files with 20 additions and 3 deletions

View file

@ -181,6 +181,9 @@ class JsonCodec extends Codec<Object, String> {
}
/// This class converts JSON objects to strings.
///
/// When used as a [StreamTransformer], this converter does not promise
/// that the input object is emitted as a single string event.
class JsonEncoder extends Converter<Object, String> {
/// The string used for indention.
///
@ -470,7 +473,14 @@ class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object> {
}
}
/// This class parses JSON strings and builds the corresponding objects.
/// This class parses JSON strings and builds the corresponding value.
///
/// A JSON input must be the JSON encoding of a single JSON value,
/// which can be a list or map containing other values.
///
/// When used as a [StreamTransformer], the input stream may emit
/// multiple strings. The concatenation of all of these strings must
/// be a valid JSON encoding of a single JSON value.
class JsonDecoder extends Converter<String, Object> {
final Function(Object key, Object value) _reviver;

View file

@ -473,6 +473,13 @@ class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object?> {
}
/// This class parses JSON strings and builds the corresponding objects.
///
/// A JSON input must be the JSON encoding of a single JSON value,
/// which can be a list or map containing other values.
///
/// When used as a [StreamTransformer], the input stream may emit
/// multiple strings. The concatenation of all of these strings must
/// be a valid JSON encoding of a single JSON value.
class JsonDecoder extends Converter<String, Object?> {
final Object? Function(Object? key, Object? value)? _reviver;