Using shared_preferences to save data in Android, iOS, and the web

The shared_preferences plugin allows simple data (key-value pairs) to be asynchronously persisted locally and is currently available for Android, iOS, and Flutter for Web.

This is possible because shared_preferences wraps different technologies based on the system on which it's run. In iOS, it leverages NSUserDefaults; in Android, it leverages SharedPreferences, and in the browser, it leverages the window.localStorage object. Basically, you have a universal way to save data and don't have to worry about duplicating any code for the different devices on which your app will be running.

shared_preferences should not be used for critical data as data stored there is not encrypted, ...

Get Flutter Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.