smf_shared_preferences 0.4.0 copy "smf_shared_preferences: ^0.4.0" to clipboard
smf_shared_preferences: ^0.4.0 copied to clipboard

The SMF module of preferences with shared_preferences for the Flutter app that SMF generates. It remembers the settings of the app that are no secret, such as the theme mode.

smf_shared_preferences #

The SMF module of preferences with shared_preferences. It provides the preferences role of SMF: the app remembers its settings that are no secret between its launches, such as the theme mode, the language, or whether the user has seen the onboarding.

The preferences role generates the AppPreferences interface, whose reads are synchronous and whose writes complete once the value is saved, and opens the preferences in bootstrap(), before the first frame. This module adds shared_preferences to the app and implements the interface on SharedPreferencesWithCache, which keeps the values in DataStore on Android and in UserDefaults on iOS. With a module that provides dependency injection, the preferences are registered in its container.

Nothing in the preferences is encrypted, and a backup of the device carries them: never store a token, a password, an API key or an encryption key there.

A read returns null when its key has no value of its type, and a number is read only as the type that it was saved as: getDouble returns null for a key with an int, and getInt for a key with a double.

Use with the SMF CLI #

smf create asks which module provides the preferences of the app, and offers none as well. To choose this one without the question:

smf create my_app -m shared_preferences

You don't add this package to an app yourself: smf create of the SMF CLI puts what the module generates into the app.

SMF generates apps for Flutter 3.44 or newer and Dart 3.12 or newer. It is tested on macOS, Linux and Windows.

Documentation #

0
likes
160
points
--
downloads

Documentation

Documentation
API reference

Publisher

verified publishersaymyframe.com

Weekly Downloads

The SMF module of preferences with shared_preferences for the Flutter app that SMF generates. It remembers the settings of the app that are no secret, such as the theme mode.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#flutter #preferences #settings #shared-preferences #persistence

License

Apache-2.0 (license)

Dependencies

mason, smf_contracts

More

Packages that depend on smf_shared_preferences