offline_sync_cache 1.0.0 copy "offline_sync_cache: ^1.0.0" to clipboard
offline_sync_cache: ^1.0.0 copied to clipboard

A simple offline-first caching utility for Dart & Flutter apps.

๐Ÿง  offline_sync_cache #

A simple and lightweight offline-first caching utility for Dart & Flutter apps.
It automatically handles memory cache, disk cache, and network fetch with expiry control.


๐Ÿš€ Features #

  • ๐Ÿง  In-memory caching for instant reads
  • ๐Ÿ’พ Disk persistence for offline access
  • ๐ŸŒ Auto-refresh via fetcher callback
  • โฐ Custom expiry duration
  • ๐Ÿงน Simple clear() to reset cache

๐Ÿ› ๏ธ Installation #

Add this line to your pubspec.yaml:

dependencies:
  offline_sync_cache: ^1.0.0

## Usage

import 'package:offline_sync_cache/offline_sync_cache.dart';

void main() async {
  final cache = SmartCache();

  // Try to read data from cache, otherwise fetch from API
  final user = await cache.read('user', fetcher: () async {
    print('Fetching from API...');
    return {'name': 'Nget Sophun', 'age': 25};
  });

  print('Cached user: $user');
}


1
likes
160
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple offline-first caching utility for Dart & Flutter apps.

Homepage

License

MIT (license)

Dependencies

flutter, path, path_provider

More

Packages that depend on offline_sync_cache