Emitter class mixin

Core reactive mixin combining a private ChangeNotifier with disposal. Extend / mix into classes that need manual notifyListeners() control.

Implemented types
Implementers
Available extensions

Constructors

Emitter()

Properties

disposed → bool
Whether dispose has already run.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether there is at least one active listener.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDispose(VoidCallback callback) → void
Registers a disposal callback. Ignored if already disposed.
override
addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
override
dispose() → void
Releases whatever this object holds. Calling it twice is an error.
override
disposeBy(Dispose disposer) → void

Available on Disposable, provided by the DisposableDisposerExtension extension

Adds this object's dispose to another Dispose collector.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Notifies all registered listeners.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
override
subscribe(VoidCallback callback) → VoidCallback

Available on Listenable, provided by the ListenableExtension extension

Adds callback as listener and returns a function to remove it.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

map<T>(List<Listenable> sources, ValueGetter<T> fn) → LazyEmitter<T>
Creates a derived LazyEmitter recomputed when any sources fire. Emits only if the newly computed value differs from the cached value.
scheduled(VoidCallback callback) → VoidCallback
Wraps callback so it is coalesced & scheduled in a microtask.
subscribe(Iterable<Listenable> sources, VoidCallback callback) → VoidCallback
handy way to addListener to a ValueNotifier and return the disposer callback