How get images from Firebase Storage? - flutter

I have an application that uses a lot of images. I would like to store these images outside the ios/android device. I decided to store some of the images in firebase storage. How can I get images using storage? Like this
Image.asset(brand.model[0].model_image[index].image,
fit: BoxFit.fill),

Its better to store all these images in your app directory it will increase your app size but the images will load faster as they will be in the app itself plus help in reducing the data usage for the user as the app will not download the images on app launch but still if you want to keep the images in a outside server Firebase Storage will be the best use.

You can keep the assets separately in a folder called assets and you can use that from there. The only thing you need to do is specify the path in pubsec.yaml file to access the images.
I would always do it like.
assets
|_____images
|_____svgs
|_____audios
Hope this will help you to keep it organized.

I'm also into Flutter and Firebase, trying to keep the actual application as small as possible. I could write everything out right here, but the creators of FlutterFire have a website that explains every step in detail. This link below will direct you to the first step of using cloud storage.
Link: FlutterFire Cloud Storage

Related

Flutter Menu App that gets pictures from firebase

I have a flutter app that is a menu for a restaurant. Now the problem is that I want to get the pictures from firebase. Currently, if you open the app, the pictures take time to load and you can see that with your eyes, it is a bit annoying and not practical regarding bandwidth data usage.
Is there any chance I can cache the images when I get them from firebase and than appear instantly? I request the links of the images once the page is open using a future and display them with a CachedNetworkImageProvider() with the image URL but that still takes time to load the images. Is there a way to download all the data in the firebase at once when you open the app and not check every time you open the app?
for all apps that require fetching images from a remote location, what i have been doing so far is download the image locally and use the local image instead of the remote one if it exists locally, from my knowledge cachedNetworkImage only caches the image after fetching when the app is currently running and refetches the image when the user restarts the app.
Please if you do find another way to cache images that would be cool and remove a lot of boiler plate code, please do post it, thanks.

Download UI contents from a URL in flutter

I am building a flutter app that will contain a lot of animated pictures and 3d objects. Many of those animations will be choosen based on the user choice of gender when registering for the first time. So one of the issues with flutter is that it normally takes a lot of storage and with this animations its gonna need even more storage. So I was wondering if there is a way to keep those animations online in some cloud or in firestore DB and then when the user register for the first time I download it and assign it to the UI to be permenantly there instead of like storing all these Gifs in the assets.
Any suggestiong to avoid storing all of the animations and images in the assets.
Since you said you have lots of images, I would suggest you use a dedicated server to store your images.
If you haven't any dedicated server, then you should use firebase to store your images.
You should follow this link to fetch images from firebase.
Also, you should follow this link to store your images in the cache & in the future fetch from the cache easily.

Best way to store video for a Flutter Application

I'm working on a Flutter App and want to include some Tutorial Videos, which all Users have unlimited access to, so they can rewatch it any time. The Videos will be about 10-20 files with 1-5 minutes length.
I guess these amount of data will be too big to be stored as app assets, so I researched a bit and found Firebase Storage and AWS MediaStore.
Thoughts on this ? Or any recommendations - I don't want to run in the wrong direction.
I suggest hosting them on a private S3 bucket with a public CloudFront distribution in front of it for best performance. HLS file groups are fine.
This might be a bit of an obvious answer but my suggestion is that you place these videos on YouTube and mark them as Unlisted. This way you can build the URLs of these videos into your Flutter application and then load those videos with a web_view plugin that you can find on pub.dev.

Flutter - How to compress image to display thumbnail?

I am making a flutter app which loads about 700+ image from Cloud Storage through Firebase. Though, I am using pagination, the app still crashes sometimes on low end devices(does not crash on emulator). I have already compressed all my images, still sometimes it crashes. Is there a way to compress images when we load them from firestore to display only low quality thumbnails. It's a wallpaper app. So what I want to do is, display low quality images when loading all of them to reduce work load on the device and then use the original quality when setting them as wallpaper.
Note: I assume you're loading the images from Cloud Storage through Firebase, and not from Firestore itself. Firestore is a document database, while Cloud Storage is used for storing files. While both are part of Firebase, it's best not to confuse them.
There is no built-in functionality to generate thumbnails in Firebase or Cloud Storage. But there is an extension to resize images that you can enable, and that will then generate a thumbnail (or your specification) when new images are uploaded.

External Storage

I am developing an app where i have thousands of images i am reading from the sdcard. I would like to say when i deploy the app, the images are downloaded together with the app. I have been trying to find a solution to this but no help. Please help!!!
The images are used as bitmap resources for imageViews. the are too many that I can't put them in drawable because they will make the app size too big.
Right now i have manually copied them over to the storage of the device i am accessing them from there. If I want to test thye app on another device then i have to copy the images folder again to the external drive of that device. Is there a way i can include them in the solution without putting them in drwable
I would suggest to keep your images on some web server and try to download the images from here.This will avaoid coping images all the time to devices .
So here is what you can do :
1 ) Upload the images on some server .
2) Also you can have a xml which will have urls of all the image.
3) When you start your application you first fetch the XML and get the urls.
4) then using these urls you can lazy load the images in your app.
try to read and understand this concept here :
Thanks