bond_cache 0.0.4+4
bond_cache: ^0.0.4+4 copied to clipboard
Cache is a Bond package provides a convenient way to handle caching in app.
Basic usage: #
import 'package:bond_cache/bond_cache.dart';
// Example usage
final user = Cache.get<User>('user', defaultValue: User(id: 1, name: 'Default User'));
// Update the cache
Cache.put<User>('user', User(id: 2, name: 'SALAH'));
// Retrieve the updated value
final updatedUser = Cache.get<User>('user');
print('User: ${updatedUser.name}');
// Check if the key exists
final exists = Cache.has('user');
print('User exists: $exists');
// Remove the value from the cache
Cache.forget('user');
Documentation #
For a comprehensive guide on how to use bond_cache, please refer to the full documentation available in the bond_docs repository under the cache.md file.