AppState class

Object to represent the application's state

This object represents the whole Pheasant Application State, and contains all functionality needed for controlling state in a pheasant application.

This object contains functionality to control state throughout an application, and also contains a list of ChangeWatchers to watch for changes throughout the cycle of an application.

The object can emit, receive, register changes and more for the application.

Inheritance

Constructors

AppState({required PheasantTemplate component, List<ChangeWatcher> watchers = const [], PheasantTemplate? initState, PheasantTemplate? disposeState})

Properties

component ↔ PheasantTemplate
The component
getter/setter pairinherited
componentState ↔ State<PheasantTemplate>
The initial state of the application
getter/setter pair
currentState → State<PheasantTemplate>
no setter
currentValue → PheasantTemplate
The current value of the variable
no setterinherited
disposeState ↔ PheasantTemplate?
The disposing state
getter/setter pairinherited
emitter ↔ ChangeEmitter
getter/setter pairinherited
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 pairinherited
initValue → PheasantTemplate
The initial value of the variable.
finalinherited
onPause → bool
Whether the state has been paused or not
no setterinherited
previousValue → PheasantTemplate
The previous value of the variable
no setterinherited
receiver ↔ ChangeReceiver
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stateChange → StateChange<PheasantTemplate>
The current state change in an application
no setter
stateStream → Stream<StateChange<PheasantTemplate>>
Stream for listening to state changes
no setter
watchers ↔ List<ChangeWatcher>
The watchers used to watch changes in an application.
getter/setter pairinherited-setteroverride-getter

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.
inherited
emit(Event event, {PheasantTemplate? templateState}) → void
Function used to emit state changes in a PheasantTemplate object.
override
freeze() → void
Function used to freeze state.
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.
override
registerWatcher<T>(State<T> variableState, T variable, {ChangeWatcher<T>? watcher}) → void
Function used to register and add a ChangeWatcher for the application
inherited
reload() → void
Function used to refresh or reload state.
removeWatcher<T>(ChangeWatcher watcher, {T? reference}) → void
Function used to remove a ChangeWatcher
inherited
toString() → String
A string representation of this object.
inherited
unfreeze() → void
Function used to unfreeze state.

Operators

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