Storing data using the Preferences API
It is a common requirement for applications to store many pieces of information, such as user configuration options, current input field contents, and a history of opened files. Using files to store this information would require additional code to format the information for storage; using a database would require additional servers or dependencies for an application. To help with this, Fyne provides a Preferences API, similar to those used by iOS and Android developers.
Data that is stored as Fyne preferences can be accessed by any code in an application using a specific string identifier, known as a key. Each value that is stored has a specific type, so developers do not have to handle any conversion or type checking. Any time that this data changes, it will be saved for future use.
In this section, we'll learn how to manage data using the Preferences API and see how we can avoid having to manually manage user data.