TypedPreferencesDao class abstract

A base class for DAOs that allows to define a schema-like object that works with SharedPreferences.

Entry creators are memoized internally and should be declared as getters.

An example DAO can look like the following:

class SettingsDao extends TypedPreferencesDao {
  SettingsDao(PreferencesDriver driver) : super(driver: driver);

  @override
  String get name => 'settings';

  PreferencesEntry<String> get userName => stringEntry('name');

  PreferencesEntry<int> get userAge => intEntry('age');
}

Constructors

TypedPreferencesDao(PreferencesDriver driver)

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

boolEntry(String key) PreferencesEntry<bool>
Creates a PreferencesEntry of type bool and caches internally.
doubleEntry(String key) PreferencesEntry<double>
Creates a PreferencesEntry of type double and caches internally.
intEntry(String key) PreferencesEntry<int>
Creates a PreferencesEntry of type int and caches internally.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stringEntry(String key) PreferencesEntry<String>
Creates a PreferencesEntry of type String and caches internally.
stringListEntry(String key) PreferencesEntry<List<String>>
Creates a PreferencesEntry of type List<String> and caches internally.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited