fetchJson method

  1. @override
Future fetchJson(
  1. Uri reference, {
  2. Object? reviver(
    1. Object? key,
    2. Object? value
    )?,
})
override

Fetch content body as JSON data from a resource identified by reference.

An optional reviver function is applied when decoding json string data. See JsonCodec of the dart:convert package for more information.

Depending on the API the reference can be a relative path, an absolute URL, a key, or other identifier relevant on a context of an API.

Throws an ApiException if fetching fails. Implementations like HTTP fetcher may also throw other status codes than codes for success as exceptions.

Implementation

@override
Future<dynamic> fetchJson(
  Uri reference, {
  Object? Function(Object? key, Object? value)? reviver,
}) async =>
    (await fetch(reference)).decodeJson(reviver: reviver);