Reputation: 685
I'm about to start working on an Encyclopedia-like app, where I'd like my object Item
to contain the main image as well as the list of other images for gallery purposes.
I've already done some research on how to store images in Flutter but I'm confused - some answered questions included:
so the question is - what is the best approach in this situation?
Any hints/tips much appreciated! :)
Upvotes: 3
Views: 1025
Reputation: 944
try like this method get more images
import 'dart:convert';
import 'dart:typed_data';
Uint8List bytesImage1;
bool bolWithImage1 = false;
try {
bytesImage1 =
base64Decode(base64StringFromSql);
bolWithImage1 = true;
} catch (err) {}
Upvotes: 0
Reputation: 658087
If you ship them statically with your application, assets will work well enough. Filter, search, and so on shouldn't be too hard.
Yes, everything will be stored in a single file with some overhead and that will cause some performance issues.
"Keeping files on disk" every way keeps the files on disks and the loading times are not avoidable. You might be able to load images in the background to have them in memory already when the user navigates to a view where they should be shown.
I would store them as asset if they are static (don't change after the app is shipped, or only with application updates)
You can use SQLite and maintain a table with meta-information about the images and a field with the image file name (and path if required) to benefit from query capabilities of a SQL database and best performance.
For more details more information is needed.
Upvotes: 1