TemplateState class

The class used in Pheasant Template Components. This class extends the base class ElementState with functionality used directly in controlling state in an application.

In every pheasant state object, there is an emitter - ChangeEmitter - and a receiver ChangeReceiver - used in receiving and emitting changes.

This object has the ability to do most of the state functionality that can be done in an ElementState or StateObject object, but has a few additional functions like emit and receive.

Inheritance
Implementers

Constructors

TemplateState({required PheasantTemplate component, PheasantTemplate? initState, List<ChangeWatcher> watchers = const <ChangeWatcher>[], PheasantTemplate? disposeState})
Constructor to create a TemplateState object.

Properties

component PheasantTemplate
The component
getter/setter pairinherited
componentState State<PheasantTemplate>
The current state of the component as a State object.
getter/setter pairinherited
currentValue PheasantTemplate
The current value of the variable
no setterinherited
disposeState PheasantTemplate?
The disposing state
getter/setter pair
emitter ↔ ChangeEmitter
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
initState PheasantTemplate
The initial state of the component - used to initialise state in a pheasant component
getter/setter pair
initValue PheasantTemplate
The initial value of the variable.
finalinherited
onPause bool
Whether the state has been paused or not
no setter
previousValue PheasantTemplate
The previous value of the variable
no setterinherited
receiver ↔ ChangeReceiver
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateStream Stream<StateChange<PheasantTemplate>>
A Stream of state changes used and updated for watching over changes in state of the element or component.
no setterinherited
watchers List<ChangeWatcher>
The watchers used to watch changes in an application.
getter/setter pair

Methods

applyState() → void
Function used in making a copy of the current state of an object to be implemented elsewhere in code.
inherited
change(PheasantTemplate newValue, {StateChange<PheasantTemplate>? stateChange}) → void
Function used to change state.
inherited
dispose() → void
Function used in disposing current component state, and disposing of any broadcast streams used in the process.
override
emit(Event event, {PheasantTemplate? templateState}) → void
Function used to emit state changes in a PheasantTemplate object.
freeze() → void
Function used to freeze state.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
receive<T>(StateChange stateChange, T refVariable) → void
Function used to receive state changes in a PheasantTemplate object.
registerWatcher<T>(State<T> variableState, T variable, {ChangeWatcher<T>? watcher}) → void
Function used to register and add a ChangeWatcher for the application
reload() → void
Function used to refresh or reload state.
inherited
removeWatcher<T>(ChangeWatcher watcher, {T? reference}) → void
Function used to remove a ChangeWatcher
toString() String
A string representation of this object.
inherited
unfreeze() → void
Function used to unfreeze state.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited