Dalon
Dalon

Reputation: 700

Flutter: can you use SharedPreferences to save a list with 300 entries?

I want to store a List of Objects local on the device. This list will not get bigger than 300 entries.

But I was wondering if the shared_preferences package is a good choice for this or is the amount of data too big?

Is there a limitation in data size?

If so, what would be a better approach?

Upvotes: 1

Views: 1638

Answers (2)

abishek perera
abishek perera

Reputation: 29

In Flutter, the maximum amount of data you can save in shared preferences is limited by the available storage on the device. Shared preferences are typically used to store small amounts of data, such as user settings or preferences, rather than large datasets.

Upvotes: 0

CrenshawDK
CrenshawDK

Reputation: 367

Yes shared_preferences will be fine here. There is no limit as such. In regards to performance it really depends on how much and how often you do writes to it. Shared preferences doesn't perform too well on writes but reads should be fine. If you're looking for something with better performance that's not SQL go with Hive or Objectbox.

Have a look here for more information about performance.

Upvotes: 0

Related Questions