lint work

This commit is contained in:
Christien Rioux
2023-07-26 14:20:17 -04:00
parent 91fab6ce5a
commit f91a350bfc
16 changed files with 791 additions and 1123 deletions

View File

@@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:typed_data';
import 'dart:convert';
import 'dart:typed_data';
/////////////////////////////////////
/// VeilidTableDB
@@ -12,16 +12,12 @@ abstract class VeilidTableDBTransaction {
Future<void> delete(int col, Uint8List key);
Future<void> storeJson(int col, Uint8List key, Object? object,
{Object? Function(Object? nonEncodable)? toEncodable}) async {
return store(col, key,
{Object? Function(Object? nonEncodable)? toEncodable}) async => store(col, key,
utf8.encoder.convert(jsonEncode(object, toEncodable: toEncodable)));
}
Future<void> storeStringJson(int col, String key, Object? object,
{Object? Function(Object? nonEncodable)? toEncodable}) {
return storeJson(col, utf8.encoder.convert(key), object,
{Object? Function(Object? nonEncodable)? toEncodable}) => storeJson(col, utf8.encoder.convert(key), object,
toEncodable: toEncodable);
}
}
abstract class VeilidTableDB {
@@ -34,20 +30,16 @@ abstract class VeilidTableDB {
Future<Uint8List?> delete(int col, Uint8List key);
Future<void> storeJson(int col, Uint8List key, Object? object,
{Object? Function(Object? nonEncodable)? toEncodable}) {
return store(col, key,
{Object? Function(Object? nonEncodable)? toEncodable}) => store(col, key,
utf8.encoder.convert(jsonEncode(object, toEncodable: toEncodable)));
}
Future<void> storeStringJson(int col, String key, Object? object,
{Object? Function(Object? nonEncodable)? toEncodable}) {
return storeJson(col, utf8.encoder.convert(key), object,
{Object? Function(Object? nonEncodable)? toEncodable}) => storeJson(col, utf8.encoder.convert(key), object,
toEncodable: toEncodable);
}
Future<Object?> loadJson(int col, Uint8List key,
{Object? Function(Object? key, Object? value)? reviver}) async {
var s = await load(col, key);
final s = await load(col, key);
if (s == null) {
return null;
}
@@ -55,13 +47,11 @@ abstract class VeilidTableDB {
}
Future<Object?> loadStringJson(int col, String key,
{Object? Function(Object? key, Object? value)? reviver}) {
return loadJson(col, utf8.encoder.convert(key), reviver: reviver);
}
{Object? Function(Object? key, Object? value)? reviver}) => loadJson(col, utf8.encoder.convert(key), reviver: reviver);
Future<Object?> deleteJson(int col, Uint8List key,
{Object? Function(Object? key, Object? value)? reviver}) async {
var s = await delete(col, key);
final s = await delete(col, key);
if (s == null) {
return null;
}
@@ -69,7 +59,5 @@ abstract class VeilidTableDB {
}
Future<Object?> deleteStringJson(int col, String key,
{Object? Function(Object? key, Object? value)? reviver}) {
return deleteJson(col, utf8.encoder.convert(key), reviver: reviver);
}
{Object? Function(Object? key, Object? value)? reviver}) => deleteJson(col, utf8.encoder.convert(key), reviver: reviver);
}