readable<T> function

Readable<T> readable<T>(
  1. T value, [
  2. StartStopNotifier<T>? start
])

Creates a store whose value cannot be set from 'outside', the first argument is the store's initial value, and the second argument to readable is the same as the second argument to writable.

final time = readable(new DateTime(), (actions) {
  actions.set(new DateTime());

  final timer = Timer.periodic(const Duration(seconds: 1), (_) {
    actions.set(new DateTime());
  });

  return timer.cancel;
});

Implementation

Readable<T> readable<T>(T value, [StartStopNotifier<T>? start]) =>
    _Readable(writeable(value, start));