StatefulData<T>.watch constructor

StatefulData<T>.watch({
  1. required Stream<T?> source(),
  2. bool isEmptyValidator(
    1. T? data
    ) = _defaultIsEmptyValidator,
})

Creates an instance of StatefulData, that watches data changes.

A source stream that provides data updates must be defined.

Implementation

StatefulData.watch({
  required Stream<T?> Function() source,
  this.isEmptyValidator = _defaultIsEmptyValidator,
}) {
  _loader = null;
  _source = source;
  loadData();
}