retriveFileContent method

Future<File> retriveFileContent({
  1. required String fileId,
  2. required String apiKey,
})

Returns the contents of the specified file.

Implementation

Future<File> retriveFileContent(
    {required String fileId, required String apiKey}) async {
  final response = await dio.get(UrlBuilder.filePathWithIdNContent(fileId),
      options: Options(headers: {'Authorization': 'Bearer $apiKey'}));
  final path = await getTemporaryDirectory();
  final file = File('$path/$fileId');
  await file.writeAsString(response.data);
  return file;
}