EvtState<T> class

The EventState can be used with stateful widgets to generate a "pulse" that you can use to change something.

Whenever you create a new event, you give it a value. Two different events are always different, even if they are created with the same value:

print(Event() == Event()) // false
print(Event<String>('abc') == Event<String>('abc')) // false

This will trigger a widget rebuild in the connector (don't forget to include the event in the view-model). Then, the didUpdateWidget method will be called. Since evt is now different from oldWidget.evt, it will run the doSomething method:

@override
void didUpdateWidget(MyWidget oldWidget) {
  super.didUpdateWidget(oldWidget);

  if (evt != oldWidget.evt) doSomethingWith(evt.value);
}

The EvtState class is never "consumed" (like the Event class is), which means you can use it with more than one widget.

Annotations

Constructors

EvtState([T? value])

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T?
final

Methods

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 equality operator.
override