decodeJson method

Future decodeJson({
  1. Object? reviver(
    1. Object? key,
    2. Object? value
    )?,
  2. int maxBytes = -1,
})

Decodes the UTF-8 body into a JSON value.

Uses decode to consume the byte stream and buffer the decoded text in memory before parsing it with jsonDecode. The optional reviver is passed to jsonDecode. Reading the body again requires a stream that supports replay.

The maxBytes limit counts UTF-8 bytes and follows the same rules as decode.

Implementation

Future<dynamic> decodeJson({
  Object? Function(Object? key, Object? value)? reviver,
  int maxBytes = -1,
}) async => jsonDecode(await decode(utf8, maxBytes: maxBytes), reviver: reviver);