import 'package:localstore/localstore.dart'; import '../api/requestCache.dart'; class DataCleaner { static Future cleanOldCache() async { var cacheData = await Localstore.instance.collection(RequestCache.collection).get(); cacheData?.forEach((key, value) async { var lastUpdate = DateTime.fromMillisecondsSinceEpoch(value['lastupdate']); if(DateTime.now().subtract(const Duration(days: 200)).isAfter(lastUpdate)) { await Localstore.instance.collection(RequestCache.collection).doc(key.split('/').last).delete(); } }); } }