diff --git a/flutter_cache_manager/lib/src/cache_manager.dart b/flutter_cache_manager/lib/src/cache_manager.dart index 82ac52a9..77e5d952 100644 --- a/flutter_cache_manager/lib/src/cache_manager.dart +++ b/flutter_cache_manager/lib/src/cache_manager.dart @@ -291,6 +291,6 @@ class CacheManager implements BaseCacheManager { /// Closes the cache database @override Future dispose() async { - await _config.repo.close(); + await _store.close(); } } diff --git a/flutter_cache_manager/lib/src/cache_store.dart b/flutter_cache_manager/lib/src/cache_store.dart index 3ad735ac..0d7768ba 100644 --- a/flutter_cache_manager/lib/src/cache_store.dart +++ b/flutter_cache_manager/lib/src/cache_store.dart @@ -199,6 +199,7 @@ class CacheStore { } Future dispose() async { + _scheduledCleanup?.cancel(); final provider = await _cacheInfoRepository; await provider.close(); }