prefman 1.2.0 prefman: ^1.2.0 copied to clipboard
A better way to manage App Preferences using persistant variables in a Structured Way.
import 'package:prefman/prefman.dart';
var settings = AppPreferences();
void main() async {
var username = settings.username.get();
settings.username.setValue('new username');
}
class AppPreferences extends SettingManifest {
final theme = Preference<String>.options(
key: 'theme',
defaultValue: 'blue',
options: [
Option('blue'),
Option('red'),
Option('orange'),
],
);
final username = Preference<String>.any(
key: 'username',
defaultValue: 'user',
);
final volume = Preference.integer(
key: 'volume',
defaultValue: 10,
min: 0,
max: 15,
);
final askAgain = Preference.boolean(
key: 'ask_again',
defaultValue: true,
);
List<Preference> get preferences => [theme, username, volume, askAgain];
}