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
statesand navigationeventsto 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)orcontext.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
buildWhenfunction which takes the previousstateand the currentstateand is responsible for returning a bool which determines whether to rebuild StateObserver with the currentstate. -
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
resultfrom this function to get that in StateNotifier. -
WidgetBuilder<
S> = Widget Function(BuildContext context, S? state) -
Signature for the
builderfunction which takes theBuildContextandstateand is responsible for returning a widget which is to be rendered.