ValueSubject<T> constructor
ValueSubject<T> (
- T seedValue, {
- void onListen()?,
- void onCancel()?,
- bool sync = false,
Constructs a ValueSubject, optionally pass handlers for
onListen
, onCancel
and a flag to handle events sync
.
seedValue
becomes the current value of Subject.
See also StreamController.broadcast.
Implementation
factory ValueSubject(
T seedValue, {
void Function()? onListen,
void Function()? onCancel,
bool sync = false,
}) {
final controller = StreamController<T>.broadcast(
onListen: onListen,
onCancel: onCancel,
sync: sync,
);
return ValueSubject._(
controller,
StreamEvent.data(seedValue),
);
}