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 convert to an object.

  • maxLength the maximal allowed length. If omitted, no limitation at all. If specified and the input is more than allowed, PayloadException will be thrown.

Implementation

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