ever_cache 0.0.8
ever_cache: ^0.0.8 copied to clipboard
Allows to cache a computed value for a specific duration.
example/ever_cache_example.dart
// ignore_for_file: avoid_print
import 'package:ever_cache/ever_cache.dart';
void main() {
final cache = EverCache<String>(
() async {
await Future.delayed(const Duration(seconds: 1));
return 'test';
},
placeholder: () => 'placeholder',
events: EverEvents(
onComputing: () => print('Computing...'),
onComputed: () => print('Computed!'),
),
earlyCompute: true,
);
print(cache.value);
}