Noobdeveloper
Noobdeveloper

Reputation: 505

Retrieve Firebase storage image without getting downloadurl flutter

How can I retrieve Firebase storage image in flutter without getting downloadUrl and display it within some image compatible widget. I don't want my users to anyhow see download url even if they open my code

Upvotes: 0

Views: 937

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599176

If you're using the FlutterFire Storage library in your app, you can call getData on a reference to the file to get its data. So with that you just need to know the path to the data, and you won't need the download URL in your application. Once you have the data locally, you can create an image out of it with: Converting a byte array to image in Flutter?

Unlike download URLs, the call to getData() is checked by security rules, so you'll have to ensure that the user is permitted to access the file.

Upvotes: 2

Related Questions