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.
Related
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.
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.
Users can scroll through the feed and retrieve videos from my cloud storage.
I would like to cache the videos (which I do successfully temporary in an array) but I want to retrieve the videos also when restarting the App.
Currently, if the user kills the app and starts again the temporary folder is of course empty.
How can I achieve that?
You need to persist the assets. There are several technologies for this, such as files in the user directory, CoreData, SQLite, etc. UserDefaults would not be recommended for such large files.
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
I'm creating an iOS app that works with photos.
I have built apps that do similar things on Android, and know of some of the pains that images can bring with regard to storage and memory management.
Here are my questions:
How do I save a picture that I've taken & where do I save it to (is it sensible to save it with core data somehow?)?
How do I load a picture from wherever I've saved it to?
For a tableview with images, do I need some form of lazy loading (you do on Android), if so, can anybody recommend a tutorial or library?
How do I save a picture that I've taken & where do I save it to (is it sensible to save it with core data somehow?)?
Use the system imagepicker/taker UIImagePickerController and no dont store images in CoreData. As a general rule store them in the system photo library. Store the Asset Library URL as a reference.
Images can be stored in your App documents folder also.
How do I load a picture from wherever I've saved it to?
Use the API in the AssetsLibrary framework to retrieve pictures from the system store.
For a tableview with images, do I need some form of lazy loading (you do on Android), if so, can anybody recommend a tutorial or library?
No. Lazy loading is done for free by your UITableViewController implementation. There are a 1001 great UITableView tutorials on the web.