getFile method

Future<File> getFile({
  1. required String bucketId,
  2. required String fileId,
})

Get file

Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.

Implementation

Future<models.File> getFile(
    {required String bucketId, required String fileId}) async {
  final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'
      .replaceAll('{bucketId}', bucketId)
      .replaceAll('{fileId}', fileId);

  final Map<String, dynamic> apiParams = {};

  final Map<String, String> apiHeaders = {
    'content-type': 'application/json',
  };

  final res = await client.call(HttpMethod.get,
      path: apiPath, params: apiParams, headers: apiHeaders);

  return models.File.fromMap(res.data);
}