readAsJson function

Future readAsJson(
  1. Stream<List<int>> stream, {
  2. Encoding encoding = utf8,
  3. int? maxLength,
})

Reads the entire stream as a JSON string using the given Encoding, and then converts to an object.

  • maxLength — maximum allowed length. If null (default), no limit. If the input exceeds it, PayloadException is thrown.

Implementation

Future<dynamic> readAsJson(Stream<List<int>> stream,
    {Encoding encoding = utf8, int? maxLength}) async
=> json.decode(await readAsString(stream,
      encoding: encoding, maxLength: maxLength));