fetchResource method
Fetches the resource identified by type
and id
.
Optional arguments:
headers
- any extra HTTP headersquery
- a collection of parameters to be included in the URI query
Implementation
Future<ResourceFetched> fetchResource(
String type,
String id, {
Map<String, List<String>> headers = const {},
Iterable<QueryEncodable> query = const [],
}) async {
final response = await send(
_baseUri.resource(type, id),
Request.get()
..headers.addAll(headers)
..query.mergeAll(query));
return ResourceFetched(
response.httpResponse, response.document ?? (throw FormatException()));
}