Skip to content

Commit

Permalink
update sembsat to version 2.3.0 (#339)
Browse files Browse the repository at this point in the history
Co-authored-by: Zia <[email protected]>
  • Loading branch information
NullNoException and Zia authored Mar 28, 2020
1 parent c297fac commit 1a45a64
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
54 changes: 30 additions & 24 deletions lib/src/storage/core_store_sem_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ part of flutter_parse_sdk;

// ignore_for_file: deprecated_member_use
class CoreStoreSembastImp implements CoreStore {
CoreStoreSembastImp._internal(this._store);
CoreStoreSembastImp._internal(this._db, this._store);

static CoreStoreSembastImp _instance;

Expand All @@ -16,86 +16,92 @@ class CoreStoreSembastImp implements CoreStore {
dbDirectory = (await getApplicationDocumentsDirectory()).path;
final String dbPath = path.join('$dbDirectory/parse', 'parse.db');
final Database db = await factory.openDatabase(dbPath, codec: codec);
_instance = CoreStoreSembastImp._internal(db);
_instance = CoreStoreSembastImp._internal(db, StoreRef.main());
}

return _instance;
}

final Database _store;
final StoreRef _store;
final Database _db;

@override
Future<bool> clear() {
return _store.clear();
return _store.drop(_db);
}

@override
Future<bool> containsKey(String key) {
return _store.containsKey(key);
return _store.record(key).exists(_db);
}

@override
Future<dynamic> get(String key) {
return _store.get(key);
Future<dynamic> get(String key)async {
return await _store.record(key).get(_db);
}

@override
Future<bool> getBool(String key) async {
final bool storedItem = await _store.get(key);
final bool storedItem = await _store.record(key).get(_db);
return storedItem;
}

@override
Future<double> getDouble(String key) async {
final double storedItem = await _store.get(key);
final double storedItem = await _store.record(key).get(_db);
return storedItem;
}

@override
Future<int> getInt(String key) async {
final int storedItem = await _store.get(key);
final int storedItem = await _store.record(key).get(_db);
return storedItem;
}

@override
Future<String> getString(String key) async {
final String storedItem = await _store.get(key);
final String storedItem = await _store.record(key).get(_db);
return storedItem;
}

@override
Future<List<String>> getStringList(String key) async {
final List<String> storedItem = await _store.get(key);
final List<String> storedItem = await _store.record(key).get(_db);
return storedItem;
}

@override
Future<void> remove(String key) {
return _store.delete(key);
Future<void> remove(String key)async {
return await _store.record(key).delete(_db);
}

@override
Future<void> setBool(String key, bool value) {
return _store.put(value, key);
Future<void> setBool(String key, bool value) async{
return await _store.record(key).put(_db, value);
// return _store.put(value, key);
}

@override
Future<void> setDouble(String key, double value) {
return _store.put(value, key);
Future<void> setDouble(String key, double value) async {
return await _store.record(key).put(_db, value);
// return _store.put(value, key);
}

@override
Future<void> setInt(String key, int value) {
return _store.put(value, key);
Future<void> setInt(String key, int value) async {
return await _store.record(key).put(_db, value);
// return _store.put(value, key);
}

@override
Future<void> setString(String key, String value) {
return _store.put(value, key);
Future<void> setString(String key, String value) async {
return await _store.record(key).put(_db, value);
// return _store.put(value, key);
}

@override
Future<void> setStringList(String key, List<String> values) {
return _store.put(values, key);
Future<void> setStringList(String key, List<String> values) async {
return await _store.record(key).put(_db, values);
// return _store.put(values, key);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
connectivity: ^0.4.6+2

#Database
sembast: ^2.1.2+3
sembast: ^2.3.0
xxtea: ^2.0.2
shared_preferences: ^0.5.6

Expand Down

0 comments on commit 1a45a64

Please sign in to comment.