Fix estimated filesize not displaying correctly when only one cache exists
This commit is contained in:
@ -17,13 +17,14 @@ class CacheView extends StatefulWidget {
|
||||
@override
|
||||
State<CacheView> createState() => _CacheViewState();
|
||||
|
||||
void clear() {
|
||||
Localstore.instance.collection(collection).delete();
|
||||
Future<void> clear() async {
|
||||
await Localstore.instance.collection(collection).delete();
|
||||
}
|
||||
|
||||
Future<int> totalSize() async {
|
||||
var data = await Localstore.instance.collection(collection).get();
|
||||
return data!.values.reduce((a, b) => jsonEncode(a).length + jsonEncode(b).length) * 8;
|
||||
if(data!.length <= 1) return jsonEncode(data.values.first).length * 8;
|
||||
return data.values.reduce((a, b) => jsonEncode(a).length + jsonEncode(b).length) * 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user