V, T> class
A MappedEvent is useful when your event value must be transformed by some function that, usually, needs the store state. You must provide the event and a map-function. The map-function must be able to deal with the spent state (null or false, accordingly).
For example, if
state.indexEvt = Event<int>(5) and you must get
a user from it:
var mapFunction = (index) => index == null ? null : state.users[index]; Event<User> userEvt = MappedEvent<int, User>(state.indexEvt, mapFunction);
read / write
- 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.read-only, inherited
- isNotSpent → bool
- isSpent → bool
↔ T Function(V
read / write
- runtimeType → Type
A representation of the runtime type of the object.
- state → T
Returns the event state.
Object other ) → bool
The StoreConnector has a
distinctparameter which may be set to
true. As a performance optimization,
distinct:trueallows 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