KeyValueProvider class

KeyValueProvider class

By default the table name is set to 'kvp'. It is important to notice that if more KeyValueProvider are created with the default table name, both the getAll and truncate method will affects all the records. To avoid this behavior, use the table paramater to give to each provider a different table name.

Constructors

KeyValueProvider({@required DbProvider dbProvider, String table: 'kvp'})

Properties

createTable ↔ String
read / write
dbProvider DbProvider
final
table → String
final
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

bulkDelete(List<KeyValue> kvps) → Future<void>
bulkDeleteKeys(List<String> keys) → Future<void>
bulkDeleteKeysStartWith(String prefixKeys) → Future<void>
bulkInsert(List<KeyValue> kvps) → Future<void>
bulkUpdate(List<KeyValue> kvps) → Future<void>
delete(KeyValue kvp) → Future<int>
deleteById(int id) → Future<int>
deleteByKey(String key) → Future<int>
getAll() → Future<List<KeyValue>>
Get all the key/value pairs stored in the table. It is important to notice that if more KeyValueProvider share the same table (by default is set to 'kvp'), this method will get the ones created with other providers. To avoid this behavior, use the table parameter to specify a different table.
getById(int id) → Future<KeyValue>
getByKey(String key) → Future<KeyValue>
getKeyValue(KeyValue kvp) → Future<KeyValue>
init() → Future<bool>
insert(KeyValue kvp) → Future<KeyValue>
insertKeyValue(String key, String value) → Future<bool>
insertMap(Map<String, String> map) → Future<void>
Given a map of type <String, String>, this method save all of its key/value pairs in the database.
truncate() → Future<int>
To delete all the records in the table. It is important to notice that if more provider used the same table (set by defalt to 'kvp') this method will delete even the key/value pairs created with the other providers. To avoid this behavior, initialize the KeyValueProvider giving to the table parameter a different value for each provider.
update(KeyValue kvp, String value) → Future<int>
updateById(int id, String value) → Future<int>
updateByKey(String key, String value) → Future<int>
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 ==(dynamic other) → bool
The equality operator.
inherited