download method

Future<DownloadableFile> download(
  1. String filename
)

return the file as downloadable/stream file

DownloadableFile file = Storage().download('images/avatar/sample.jpeg');
return file;

or

DownloadableFile file = Storage().download('images/avatar/sample.jpeg');
return response(file);

Implementation

Future<DownloadableFile> download(String filename) async {
  StreamFile streamFile = await stream(filename);
  String name = filename.split('/').last;
  return DownloadableFile(streamFile.contentType, streamFile.stream, name);
}