get method

Get the file object at the server for this FileStorageReference.

Implementation

Future<CarpFileResponse> get() async {
  assert(id > 0);
  final String url = "$fileEndpointUri/$id";

  final response = await service._get(url);
  int httpStatusCode = response.statusCode;
  Map<String, dynamic> responseJson =
      json.decode(response.body) as Map<String, dynamic>;

  switch (httpStatusCode) {
    case HttpStatus.ok:
      return CarpFileResponse._(responseJson);
    default:
      throw CarpServiceException.fromMap(httpStatusCode, responseJson);
  }
}