DistinctValueSubject<T> constructor
DistinctValueSubject<T> (})
Constructs a DistinctValueSubject, optionally pass handlers for
onListen
, onCancel
and a flag to handle events sync
.
seedValue
becomes the current value of Subject.
equals
is used to determine equality between previous data event and current data event.
See also StreamController.broadcast, ValueSubject
.
Implementation
factory DistinctValueSubject(
T seedValue, {
bool Function(T p1, T p2)? equals,
void Function()? onListen,
FutureOr<void> Function()? onCancel,
bool sync = false,
}) {
final subject = ValueSubject<T>(
seedValue,
onListen: onListen,
onCancel: onCancel,
sync: sync,
);
return DistinctValueSubject._(
equals ?? DistinctValueStream.defaultEquals, subject);
}