How can I download a pdf from firebase and access it from my app directory?

680

With help from here:

var dir = (await getApplicationDocumentsDirectory()).path;
var req = await http.Client().get(Uri.parse(url));
var file = File('$dir/$filename');
return file.writeAsBytes(req.bodyBytes);
Share:
680
JaredKarl
Author by

JaredKarl

Full-stack Developer, Specializing in Flutter, C#, Javascript, PHP, Laravel Framework

Updated on December 15, 2022

Comments

  • JaredKarl
    JaredKarl over 1 year

    I have an app in flutter which I am able to upload pdf into firebase storage successfully. I am able to fetch the respective url but when I click on it, it downloads outside of the app. This is not what I want, I would like to get the pdf download within the app. Any help will be appreciated.