flutter_onlooker library

Classes

Provider<N extends StateNotifier>
A generic implementation of InheritedWidget that allows to obtain StateNotifier using Provider.of for any descendant of this widget.
StateNotifier
This class provides mechanism of delivering new UI states and navigation events to widgets. Widgets should use getStateStream and getNavigationStream to observe on StateNotifier events.
StateNotifierProvider<N extends StateNotifier>
Takes a Create function that is responsible for creating the StateNotifier, child which will have access to the instance via Provider.of<StateNotifier>(context) or context.read<StateNotifier>() and optional router function that will receive navigation events.
StateObserver<N extends StateNotifier, S>
StateObserver handles building a widget in response to new states.

Extensions

ReadContext on BuildContext
Exposes the read method.

Typedefs

Condition<S> = bool Function(S? previous, S? 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 StateObserver with the current state.
Create<T> = T Function(BuildContext context)
A function that creates an object of type T.
ResultConsumer<T> = void Function(Future<T>?)
A callback function that is used to return navigation result to the StateNotifier.
Router<T> = Future<T>? Function(BuildContext context, dynamic route)
A function that listens for navigation events. Return navigation result from this function to get that in StateNotifier.
WidgetBuilder<S> = Widget Function(BuildContext context, S? state)
Signature for the builder function which takes the BuildContext and state and is responsible for returning a widget which is to be rendered.