EventMultiple<T> class
An Event from multiple sub-events. When consuming this event, if the first sub-event is not spent, it will be consumed, and the second will not. If the first sub-event is spent, the second one will be consumed.
So, if both sub-events are NOT spent, the multiple-event will have to be consumed twice to consume both sub-events.
If both sub-events are spent, the multiple-event returns null when consumed.
For example:
Event getTypedMessageEvt() {
return EventMultiple(setTypedMessageEvt, widget.setTypedMessageEvt);
}
Constructors
- EventMultiple(Event? evt1, Event? evt2)
Properties
-
evt1
↔ Event<
T> -
getter/setter pair
-
evt2
↔ Event<
T> -
getter/setter pair
- hashCode → int
-
- If two objects are equal according to the equals method, then hashcode of both must be the same. Since spent events are all equal, they should produce the same hashcode.
- If two objects are NOT equal, hashcode may be the same or not, but it's better when they are not the same. However, events are mutable, and this could mean the hashcode of the state could be changed when an event is consumed. To avoid this, we make events always return the same hashCode.
no setterinherited - isNotSpent → bool
-
no setterinherited
- isSpent → bool
-
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → T?
-
Returns the event state.
no setteroverride
Methods
-
consume(
) → T? -
Returns the event state and consumes the event.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The StoreConnector has a
distinct
parameter which may be set totrue
. As a performance optimization,distinct:true
allows the widget to be rebuilt only when the ViewModel changes. If this is not done, then every time any state in the store changes the widget will be rebuilt.inherited