flutter_lid library

Classes

LidBuilder<T>
LidBuilder handles building a widget in response to new states. LidBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed. Specify the stateNotifier. Please refer to LidListener if you want to "do" anything in response to state changes such as navigation, showing a dialog, etc...
LidConsumer<S>
LidConsumer exposes a builder and listener in order react to new states. LidConsumer is analogous to a nested LidListener and LidBuilder but reduces the amount of boilerplate needed. LidConsumer should only be used when it is necessary to both rebuild UI and execute other reactions to state changes in the stateNotifier.
LidListener<T>
Takes a LidWidgetListener and an optional stateNotifier and invokes the listener in response to state changes in the stateNotifier. 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 LidBuilder. Specify the stateNotifier.
LidSelector<S, T>
LidSelector is analogous to LidBuilder but allows developers to filter updates by selecting a new value based on the state. Unnecessary builds are prevented if the selected value does not change.
MultiLidListener
Merges multiple LidListener widgets into one widget tree.

Extensions

StateNotifierExtension on StateNotifier<S>

Typedefs

BuilderCondition<T> = bool Function(T previous, T current)
Signature for the buildWhen function which takes the previous state and the current state and is responsible for returning a bool which determines whether to rebuild LidBuilder with the current state.
LidWidgetBuilder<T> = Widget Function(BuildContext context, T value)
Signature for the builder function which takes the BuildContext and the state value and is responsible for returning a widget which is to be rendered. This is analogous to the builder function in StreamBuilder.
LidWidgetListener<T> = void Function(BuildContext context, T value)
Signature for the listener function which takes the BuildContext along with the state value and is responsible for executing in response to state changes.
LidWidgetSelector<S, T> = T Function(S state)
Signature for the selector function which is responsible for returning a selected value, T, based on state.
ListenerCondition<T> = bool Function(T previous, T current)
Signature for the listenWhen function which takes the previous state and the current state and is responsible for returning a bool which determines whether or not to call LidWidgetListener of LidListener with the current state