state_tools library

Classes

DoubleStateBuilder<S1, S2>
DoubleStateListener<S1, S2>
Takes a StateNotifier and invokes the listener in response to state changes. It should be used for functionality that needs to occur only in response to a state change such as navigation, showing a SnackBar, showing a Dialog, etc... The listener is guaranteed to only be called once for each state change unlike the builder in StateBuilder.
ListStateNotifier<S>
Specialized StateNotifier for List data types. With this StateNotifier type you can set a filter and work with only a subset (filtered items) of the main List.
NIL
Type which represents objects that do not support json encoding
PersistableStateNotifier<S>
Specialized StateNotifier which handles initializing the StateNotifier state based on the persisted state. This allows state to be persisted across application restarts.
StateAesCipher
Default encryption algorithm. Uses AES256 CBC with PKCS7 padding.
StateBuilder<S>
StateBuilder handles building a widget in response to new states. StateBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed as well as state-specific performance improvements.
StateCipher
Abstract cipher can be implemented to customize encryption.
StateListener<S>
Takes a StateNotifier and invokes the listener in response to state changes. It should be used for functionality that needs to occur only in response to a state change such as navigation, showing a SnackBar, showing a Dialog, etc... The listener is guaranteed to only be called once for each state change unlike the builder in StateBuilder.
StateNotifier<S>
State Notifier base class.
StateObserver
A StateObserver which will be used to notify about state changes. The observer notify each state changing on events:
StateStorage
Implementation of Storage which uses package:hive to persist and retrieve state changes from the local device.
StateTools
StateUtils
Storage
Interface which is used to persist and retrieve state changes.
TripleStateBuilder<S1, S2, S3>
TripleStateListener<S1, S2, S3>
Takes a StateNotifier and invokes the listener in response to state changes. It should be used for functionality that needs to occur only in response to a state change such as navigation, showing a SnackBar, showing a Dialog, etc... The listener is guaranteed to only be called once for each state change unlike the builder in StateBuilder.

Mixins

ListingSupport<S>

Functions

different<S>(S? previous, S current) bool
Checker for the buildWhen and listenWhen functions which takes the previous state and the current state and returns true if they are not equals (aka different).
equals<S>(S? previous, S current) bool
Checker for the buildWhen and listenWhen functions which takes the previous state and the current state and returns true if they are equals.

Typedefs

StateConditionFunction<S> = bool Function(S? previous, S current)
Signature for the buildWhen and listenWhen functions which takes the previous state and the current state and is responsible for returning a bool which determines whether to the new state should be emitted to the expected widget.
StateConditionFunction2<S1, S2> = bool Function(S1? previous1, S1 current1, S2? previous2, S2 current2)
Signature for the buildWhen and listenWhen functions which takes the previous state and the current state and is responsible for returning a bool which determines whether to the new state should be emitted to the expected widget.
StateConditionFunction3<S1, S2, S3> = bool Function(S1? previous1, S1 current1, S2? previous2, S2 current2, S3? previous3, S3 current3)
Signature for the buildWhen and listenWhen functions which takes the previous state and the current state and is responsible for returning a bool which determines whether to the new state should be emitted to the expected widget.
StateHandlerFunction<S> = Widget Function(BuildContext context, S state)
Signature for the builder and listener functions which takes the BuildContext of the widget and the current state emitted from StateNotifier.
StateHandlerFunction2<S1, S2> = Widget Function(BuildContext context, S1 state1, S2 state2)
Signature for the builder and listener functions which takes the BuildContext of the widget and the current state emitted from StateNotifier.
StateHandlerFunction3<S1, S2, S3> = Widget Function(BuildContext context, S1 state1, S2 state2, S3 state3)
Signature for the builder and listener functions which takes the BuildContext of the widget and the current state emitted from StateNotifier.
StateListenerFunction<S> = void Function(BuildContext context, S state)
Signature for the builder and listener functions which takes the BuildContext of the widget and the current state emitted from StateNotifier.
StateListenerFunction2<S1, S2> = void Function(BuildContext context, S1 state1, S2 state2)
Signature for the builder and listener functions which takes the BuildContext of the widget and the current state emitted from StateNotifier.
StateListenerFunction3<S1, S2, S3> = void Function(BuildContext context, S1 state1, S2 state2, S3 state3)
Signature for the builder and listener functions which takes the BuildContext of the widget and the current state emitted from StateNotifier.

Exceptions / Errors

PersistableCyclicError
Reports that an object could not be serialized due to cyclic references. When the cycle is detected, a PersistableCyclicError is thrown.
PersistableUnsupportedError
Reports that an object could not be serialized. The unsupportedObject field holds object that failed to be serialized.
StorageNotFound
Exception thrown if there was no StateStorage specified. This is most likely due to forgetting to setup the StateStorage: