Skip to main content

app_cache_manager 0.0.2 copy "app_cache_manager: ^0.0.2" to clipboard
app_cache_manager: ^0.0.2 copied to clipboard

discontinued
outdated

Flutter Package for Managing Application Cache

App Cache Manager #

A Flutter package for managing application cache efficiently. This package provides methods to check cache existence, calculate total cache size, and clear the cache. It is designed to simplify cache management, especially for file system caching.

Features #

  • Check if cache exists
  • Calculate total cache size
  • Clear cache

Installation #

To use this package, add app_cache_manager as a dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter
  app_cache_manager: ^0.0.2  # Use the latest version

Then run the following command to fetch the package:

flutter pub get

Usage #

                         *****

import 'package:app_cache_manager/app_cache_manager.dart';

 class _ExampleState extends State<Example> {
   String cacheSize = '';
   late final ICacheManager iCacheManager;

   @override
   void initState() {
    super.initState();
     iCacheManager = CacheManager();
     updateCacheSize();
   }

   @override
   void didUpdateWidget(Settings oldWidget) {
     super.didUpdateWidget(oldWidget);
     updateCacheSize();
   }

   @override
   Widget build(BuildContext context) {
     return Scaffold(
       body: ListTile(
       trailing:Text(cacheSize),
       onTap: () async {
             iCacheManager.clearCache();
             updateCacheSize();
         },
     ),
 );

  void updateCacheSize() async {
     String newSize = await iCacheManager.getTotalCacheSize();
     setState(() => cacheSize = newSize);
   }
 }

Contributing #

Contributions are welcome! Please feel free to submit issues and pull requests.

Additional information #

This package provides a unified way to manage cache in Flutter applications across both Android and iOS platforms. The cache management is achieved through a combination of Flutter and native code.

Android Cache Management #

Android cache management is handled entirely within the Flutter environment. The package leverages the getTemporaryDirectory method from the path_provider package to access and manage the Android cache directory. The methods provided by the package are platform-agnostic and work seamlessly on Android.

iOS Cache Management #

For iOS cache management, native Swift code is used to interact with the cache system. The package includes a Swift bridge that communicates with the Flutter environment through method channels. This approach ensures efficient and accurate cache management on iOS devices.

2
likes
0
points
53
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Package for Managing Application Cache

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, path_provider

More

Packages that depend on app_cache_manager