zeba_academy_cache_manager 1.0.1 copy "zeba_academy_cache_manager: ^1.0.1" to clipboard
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:

  1. Fork the repository
  2. Create a new branch
  3. 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!

0
likes
130
points
119
downloads

Documentation

API reference

Publisher

verified publisherzeba.academy

Weekly Downloads

Advanced caching system for Flutter apps with API caching, image caching, memory + disk layers, automatic expiry, smart preloading and background refresh.

Homepage

License

unknown (license)

Dependencies

crypto, flutter, http, path_provider

More

Packages that depend on zeba_academy_cache_manager