Emitter<T> class

Emitter creates a stream of Future

When an emitter firstly being watched, it create an empty future, which is completed by the first emit call. Subsequence emit call will update its state to Future.value.

This means that when emitter notifies its watcher about a state change, its watcher gets a Future.value, which can resolves immediately.

Inheritance
Available extensions

Constructors

Emitter(FutureOr<void> create(Ref ref, void emit(T? value, [Object? error, StackTrace? stackTrace])), {String? name, bool keepAlive = false, List<Object?>? args})
const
Emitter.stream(FutureOr<Stream<T>> stream(Ref ref), {String? name, bool keepAlive = false, List<Object?>? args})
Create an Emitter from an existing stream. It works both sync and async.

Properties

args List<Object?>?
Creator with the same args are considered the same. args need to be unique within the graph.
finalinherited
asyncData Creator<AsyncData<T>>

Available on Emitter<T>, provided by the EmitterAsyncData extension

Creator of AsyncData
no setter
change Emitter<Change<T>>

Available on Emitter<T>, provided by the EmitterChange extension

Return Emitter<Change
no setter
create FutureOr<void> Function(Ref ref, void emit(T? value, [Object? error, StackTrace? stackTrace]))
User provided create function. It can use ref to get data from the graph then call emit to push data to the graph. emit can be called multiple times. If error is set, value is ignored.
final
debugName String
no setterinherited
hashCode int
See args.
no setterinherited
infoName String
no setterinherited
keepAlive bool
Whether to keep the creator alive even if it loses all its watchers.
finalinherited
name String?
Name for logging purpose.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asyncMap<F>(Future<F> map(T), {String? name, bool keepAlive = false, List<Object?>? args}) Emitter<F>

Available on Emitter<T>, provided by the EmitterExtension extension

expand<F>(Iterable<F> convert(T), {String? name, bool keepAlive = false, List<Object?>? args}) Emitter<F>

Available on Emitter<T>, provided by the EmitterExtension extension

map<F>(F map(T), {String? name, bool keepAlive = false, List<Object?>? args}) Emitter<F>

Available on Emitter<T>, provided by the EmitterExtension extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(T combine(T previous, T element), List<Object?>? args, {String? name, bool keepAlive = false}) Emitter<T>

Available on Emitter<T>, provided by the EmitterExtension extension

Set args to some unique value if creator is used on the fly, or null if the creator defined in a stable variable. See CreatorBase.args.
toString() String
A string representation of this object.
inherited
where<F>(bool test(T), {String? name, bool keepAlive = false, List<Object?>? args}) Emitter<F>

Available on Emitter<T>, provided by the EmitterExtension extension

Operators

operator ==(dynamic other) bool
See args.
inherited