StateElement class

The base class for everything within your state. A state element holds a reference to its parent, contains options that have been passed to StateObject, and has a broadcast stream for notifying listeners when it has been modified, removed from state or in the case of StateValue<Null>, instantiated. StateElement can be extended to create custom state models with complex data types and restrictions on how data can be accessed or modified i.e. state models.

Implementers

Constructors

StateElement(StateElement parent)

Properties

converter StateElement Function(dynamic value, StateElement parent)
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
notifications Stream<StateElementNotification>
Returns a stream that can be subscribed to that receives StateElementNotifications upon changes
read-only
notifyParent bool
read / write
parent StateElement
final
removedFromState bool
Whether a state element has been removed from the state tree
read-only
rootElement RootStateElement
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
typeSafety TypeSafety
read / write
typing StateValueTyping
read / write

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyChange() → void
notifyRemovedFromState() → void
should be called after a state element is no longer part of the state. This will cause your app to throw an error if you accidentally try to access or modify an element that's no longer in state.
subscribe(void callback(StateElementNotification notification)) StreamSubscription<StateElementNotification>
Subscripes to notifications and calls the callback upon an event will be depricated. Use notifications instead.
toPrimitive() → dynamic
Should be overriden if you need to convert the state to JSON. Attempts to convert a state element to primitive values before converting to JSON
toString() String
A string representation of this object. [...]
inherited

Operators

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