getFileDownload method
Get File for Download
Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
Implementation
Future<req.Response> getFileDownload({required String fileId}) {
final String path = '/storage/files/{fileId}/download'
.replaceAll(RegExp('{fileId}'), fileId);
final Map<String, dynamic> params = {
'project': client.config['project'],
};
params.keys.forEach((key) {
if (params[key] is int || params[key] is double) {
params[key] = params[key].toString();
}
});
return client.call(HttpMethod.get,
path: path, params: params, responseType: dio.ResponseType.bytes);
}