Closed magicleon94 closed 3 years ago
@magicleon94 closing this in favor of exposing a public FlowController
which you can use to notify others of changes in the flow state
class _MyWidgetState extends State<MyWidget> {
FlowController<MyFlowState> _controller;
@override
void initState() {
super.initState();
_controller = FlowController(MyFlowState.initial())..addListener(_onFlowStateChanged);
}
void _onFlowStateChanged() {
final state = context.flow<MyFlowState>().state;
// notify other components of a change in flow state
}
@override
Widget build(BuildContext context) {
return FlowBuilder(
controller: _controller,
onGeneratePages: ...,
);
}
@override
void dispose() {
_controller
..removeListener(_onFlowStateChanged)
..dispose();
super.dispose();
}
}
Hope that helps ๐
I think this is gonna help for sure! Thank you a lot for this!
Status
READY
Breaking Changes
NO
Description
This callback gets called whenever a page is popped and can be used to notify the state manager that something has occurred. An example of how it can be used with bloc can be found here.
Type of Change