W3cubDocs

/Dart 2

startChunkedConversion method

ChunkedConversionSink<Object> startChunkedConversion (Sink<String> sink)

Starts a chunked conversion.

The converter works more efficiently if the given sink is a StringConversionSink.

Returns a chunked-conversion sink that accepts at most one object. It is an error to invoke add more than once on the returned sink.

Implementation

ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) {
  if (sink is! StringConversionSink) {
    sink = new StringConversionSink.from(sink);
  } else if (sink is _Utf8EncoderSink) {
    return new _JsonUtf8EncoderSink(
        sink._sink,
        _toEncodable,
        JsonUtf8Encoder._utf8Encode(indent),
        JsonUtf8Encoder._defaultBufferSize);
  }
  return new _JsonEncoderSink(sink, _toEncodable, indent);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-convert/JsonEncoder/startChunkedConversion.html