zeba_academy_cache_manager 1.0.1
zeba_academy_cache_manager: ^1.0.1 copied to clipboard
Advanced caching system for Flutter apps with API caching, image caching, memory + disk layers, automatic expiry, smart preloading and background refresh.
zeba_academy_cache_manager #
A powerful and lightweight Flutter caching solution with API caching, image caching, memory + disk layers, automatic expiry, smart preloading, and background refresh.
This package helps Flutter apps load faster, reduce API calls, and work efficiently with cached data.
โจ Features #
- ๐ API Response Caching
- ๐ผ Image Caching
- โก Memory Cache Layer
- ๐พ Disk Cache Layer
- โณ Automatic Cache Expiry
- ๐ Background Cache Refresh
- ๐ฆ Smart Preloading
- ๐ฑ Optimized for Flutter Apps
- ๐งช Tested and Production Ready
๐ฆ Installation #
Add this to your pubspec.yaml:
dependencies:
zeba_academy_cache_manager: ^1.0.0
Then run:
flutter pub get
๐ Usage #
Import the package:
import 'package:zeba_academy_cache_manager/zeba_academy_cache_manager.dart';
๐ง API Caching #
Cache API responses automatically.
final data = await ApiCache.get(
"https://api.example.com/data",
);
print(data);
If the response is cached, it will be returned instantly without hitting the API again.
โณ Custom Cache Expiry #
final data = await ApiCache.get(
"https://api.example.com/data",
expiry: Duration(minutes: 5),
);
๐พ Manual Cache Usage #
Store custom data in cache.
await ZebaCacheManager.instance.set(
"user_profile",
'{"name":"John"}',
);
Retrieve cached data:
final data =
await ZebaCacheManager.instance.get("user_profile");
๐ผ Image Caching #
Load images with disk caching.
final image = await ImageCacheManager.load(
"https://example.com/image.png",
);
Usage in widget:
Image(image: image)
โก Smart Preloading #
Preload important data before the user needs it.
await ZebaCacheManager.instance.preload([
"https://api.example.com/home",
"https://api.example.com/profile",
]);
๐ Background Refresh #
Update cache in background without blocking UI.
await ZebaCacheManager.instance.refresh(
"user_data",
() async {
return await fetchUserDataFromApi();
},
);
๐ Cache Architecture #
This package uses a multi-layer caching system:
App
โ
โผ
Memory Cache (fast)
โ
โผ
Disk Cache (persistent)
โ
โผ
Network/API
Benefits:
- Faster app performance
- Reduced network usage
- Offline-friendly data access
๐ Use Cases #
This package is useful for:
- API heavy apps
- Social media apps
- News apps
- E-commerce apps
- Offline-first applications
- Image-heavy apps
๐ค Contributing #
Contributions are welcome!
If you find a bug or want to improve the package:
- Fork the repository
- Create a new branch
- Submit a pull request
๐ License #
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
You are free to use, modify, and distribute this software under the terms of the GPL-3.0 license.
Any derivative work must also be distributed under the same license.
See the LICENSE file for the full license text.
๐จโ๐ป About Me #
โจ Iโm Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.
You can learn more about me and my work at https://sufyanism.com/
Or connect with me on LinkedIn https://www.linkedin.com/in/sufyanism
๐ Your all-in-one no-bloat hub! #
Explore cutting-edge resources in coding, tech, and development at zeba.academy and code.zeba.academy.
Empower yourself with practical skills through curated directives, real-world projects, and hands-on experience.
Level up your tech game today! ๐ปโจ
๐ Zeba Academy #
Zeba Academy is a learning platform dedicated to coding, technology, and development.
โก Visit our main site https://zeba.academy
โก Explore hands-on courses and resources https://code.zeba.academy
โก Watch tutorials on YouTube https://www.youtube.com/@zeba.academy
โก Follow us on Instagram https://www.instagram.com/zeba.academy/
Thank you for visiting!