cached_streamable 1.0.2 copy "cached_streamable: ^1.0.2" to clipboard
cached_streamable: ^1.0.2 copied to clipboard

outdated

A dead-simple interface for creating a streamable data source.

example/main.dart

// ignore_for_file: avoid_print

import 'package:cached_streamable/cached_streamable.dart';

class CounterRepository extends CachedStreamable<int> {
  CounterRepository() : super(0);

  // Some arbitrary future that updates the internal cache
  Future<void> increment() =>
      Future<void>.delayed(Duration.zero, () => cache = cache + 1);

  int get value => cache;
}

Future<void> main() async {
  final counter = CounterRepository()..stream.listen(print);

  // prints "1"
  await counter.increment();

  /// don't forget to close
  await counter.close();
}
1
likes
0
points
198
downloads

Publisher

unverified uploader

Weekly Downloads

A dead-simple interface for creating a streamable data source.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on cached_streamable