prefman 1.2.0 copy "prefman: ^1.2.0" to clipboard
prefman: ^1.2.0 copied to clipboard

A better way to manage App Preferences using persistant variables in a Structured Way.

example/example.dart

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];
}
2
likes
150
points
58
downloads

Publisher

verified publisheraligator.ir

Weekly Downloads

A better way to manage App Preferences using persistant variables in a Structured Way.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on prefman