TailorDB class

Wrapper class for interacting with a database. These databases are organized as a key-value store (similar to a Map).

Constructors

TailorDB({@required File file, bool encryption: false, String passkey: '', int refreshInterval: 250})
Initialize the database with a JSON file that it can write to for persistent storage. You can get this file using path_provider in Flutter. [...]

Properties

encryption → bool
Returns whether this database is being encrypted.
read-only
isEmpty → bool
Returns whether this database is empty.
read-only
isFlushed → bool
Returns true if the current cache state has been loaded into persistent storage. The frequency of these loads can be changed via the constructor. The loads can be manually induced via writeCache.
read-only
keys → Iterable
Returns the keys of this database.
read-only
keysAsync → Future<Iterable>
Asynchronously returns the keys of this database.
read-only
values → Iterable
Returns the values of this database.
read-only
valuesAsync → Future<Iterable>
Asynchronously returns the values of this database.
read-only
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

add({String key, dynamic value}) → void
Adds key:value to end of database. [...]
addAsync({String key, dynamic value}) → Future<void>
Asynchronously adds key:value to end of database. [...]
clear() → void
Clear everything off this database.
containsKey({String key}) → void
Returns whether this database contains given key.
containsKeyAsync({String key}) → Future<void>
Asynchronously returns whether this database contains given key.
containsValue({dynamic value}) → void
Returns whether this database contains given value.
containsValueAsync({dynamic value}) → Future<void>
Asynchronously returns whether this database contains given value.
get({String key}) → dynamic
Get the value associated with this key. This can also be done using the [] operator.
getAsync({String key}) → Future
Asynchronously get the value associated with this key. This can also be done using the [] operator.
remove({String key}) → void
Removes given key and associated value from database.
removeAsync({String key}) → Future<void>
Asynchronously removes given key and associated value from database.
writeCache({bool sync: false}) → void
Manually load the cache state into the database. It is automatically loaded at the rate specified in the constructor. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator [](String key) → dynamic
Get the value associated with this key. This can also be done using the get method.
operator ==(dynamic other) → bool
The equality operator.
inherited