Tx<T> constructor
Tx<T> (
- T value, {
- void beforeChange(
- T
- void afterChange(
- T
The Tx<T>
constructor. Tx<T>
is a Trackable variable that can used to set callbacks which can be called before and after changes are made to the variable. The variable is of generic type T
which means it can hold any type of value.
T value
Should be used to initialise the variable.
void Function(T)? beforeChange
Is called just before a change of value happens to the variable. This can be null, in which case, there will be no callback before change in value.
void Function(T)? afterChange
Is called immediately after a change of value of the variable happens. This can be null, in which case, there will be no callback after change in value.
Implementation
Tx(
T value, {
void Function(T)? beforeChange,
void Function(T)? afterChange,
}) : this._value = value {
this.beforeChange = beforeChange;
this.afterChange = afterChange;
}