clever_settings library
Clever Settings is a Dart package that provides an easy way to manage and store settings for your application.
It uses Hive, a lightweight and fast key-value store, to persist the settings data.
Example:
// init hive to store data. With flutter use Hive.initFlutter
final path = Directory.current.path;
Hive.init(path);
await CleverSettings.open();
print('Is dark mode on? ${Settings.darkMode.value}');
// This is automatically saved to disk.
Settings.darkMode.value = true;
print('The user is ${Settings.user.value}');
// This is also stored across restarts.
Settings.user.value = User(name: 'John Doe', age: 22);
Classes
- CleverSettings
- Static class for functions to control settings
-
DefaultSettingsValue<
T> - A settings value that provides a default value if no value is specified by the user.
-
SerializableSettingsValue<
T> - SerializableSettingsValue allows you to store and retrieve values that can be serialized to and from JSON format.
-
SettingsValue<
T> - SettingsValue is a generic class that represents a setting in an application.
Constants
- kSettingsBox → const String
- Constant value used for the settings box in Hive.