Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre SharedPreferences | Local Storage
Flutter State and Data Handling

SharedPreferences

Glissez pour afficher le menu

Note
Definition

SharedPreferences provides a lightweight way to store simple key-value pairs locally in Flutter apps. It is ideal for saving user preferences, flags, or other small pieces of data that need to persist between app launches but do not require the complexity of a full database.

Unlike more complex storage solutions, SharedPreferences is synchronous and easy to use, making it a go-to option for persisting primitive data types.

main.dart

main.dart

SharedPreferences supports storing primitive types such as int, double, bool, String, and List<String>. Data saved with SharedPreferences persists even after the app is closed or restarted, as shown in the example above. However, it is not suitable for large or complex data structures, and you should use it only for simple, lightweight storage needs.

main.dart

main.dart

question mark

Which of the following statements best describes the limitations and typical use cases of SharedPreferences in Flutter?

Sélectionnez la réponse correcte

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 1

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Section 3. Chapitre 1
some-alt