15 lines
568 B
Dart
15 lines
568 B
Dart
import 'package:localstore/localstore.dart';
|
|
|
|
import '../widget/debug/cacheView.dart';
|
|
|
|
class DataCleaner {
|
|
static void cleanOldCache() async {
|
|
var cacheData = await Localstore.instance.collection(CacheView.collection).get();
|
|
cacheData?.forEach((key, value) async {
|
|
DateTime lastUpdate = DateTime.fromMillisecondsSinceEpoch(value['lastupdate']);
|
|
if(DateTime.now().subtract(const Duration(days: 200)).isAfter(lastUpdate)) {
|
|
await Localstore.instance.collection(CacheView.collection).doc(key.split('/').last).delete();
|
|
}
|
|
});
|
|
}
|
|
} |