updated localstore collection to global constant
This commit is contained in:
@ -8,21 +8,21 @@ import 'package:jiffy/jiffy.dart';
|
||||
import 'package:localstore/localstore.dart';
|
||||
|
||||
import '../../../widget/placeholderView.dart';
|
||||
import '../../api/requestCache.dart';
|
||||
import 'jsonViewer.dart';
|
||||
|
||||
class CacheView extends StatefulWidget {
|
||||
static String collection = 'MarianumMobile';
|
||||
const CacheView({super.key});
|
||||
|
||||
@override
|
||||
State<CacheView> createState() => _CacheViewState();
|
||||
|
||||
Future<void> clear() async {
|
||||
await Localstore.instance.collection(collection).delete();
|
||||
await Localstore.instance.collection(RequestCache.collection).delete();
|
||||
}
|
||||
|
||||
Future<int> totalSize() async {
|
||||
var data = await Localstore.instance.collection(collection).get();
|
||||
var data = await Localstore.instance.collection(RequestCache.collection).get();
|
||||
if(data!.length <= 1) return jsonEncode(data.values.first).length * 8;
|
||||
return data.values.reduce((a, b) => jsonEncode(a).length + jsonEncode(b).length) * 8;
|
||||
}
|
||||
@ -34,7 +34,7 @@ class _CacheViewState extends State<CacheView> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
files = Localstore.instance.collection(CacheView.collection).get();
|
||||
files = Localstore.instance.collection(RequestCache.collection).get();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user