EventSinkSignalMixin
EventSinkSignalMixin is a mixin for a Signal that implements EventSink.
class MySignal extends Signal<AsyncState<int>> with EventSinkSignalMixin<int> { MySignal(int value) : super(AsyncState.data(value));}
void main() { final signal = MySignal(0); signal.add(1); print(signal.value.hasValue); // true print(signal.value.value); // 1 signal.addError('error'); print(signal.value.hasError); // true print(signal.value.error); // error signal.close(); print(signal.disposed); // true}This allows you to use the signal as a EventSink anywhere you would use a EventSink in Dart.
.add()
Section titled “.add()”When add is called it will set the value of the signal.
.addError()
Section titled “.addError()”When addError is called it will set the error of the signal.
.close()
Section titled “.close()”When close is called it will dispose the signal and remove all listeners.