getSpace method

Future<Space> getSpace({
  1. required Uri uri,
  2. Map<String, String> headers = const {},
})

Get the Space represented by spaceUri

headers will be added in addition to ApptiveGridClient.defaultHeaders

Requires Authorization throws Response if the request fails

Implementation

Future<Space> getSpace({
  required Uri uri,
  Map<String, String> headers = const {},
}) async {
  await authenticator.checkAuthentication();

  final url = _generateApptiveGridUri(uri);
  final response =
      await _client.get(url, headers: _createHeadersWithDefaults(headers));
  if (response.statusCode >= 400) {
    throw response;
  }
  return Space.fromJson(json.decode(response.body));
}