I am using Navigator 2.0 and I have my state stored inside the RouterDelegate so that I can have the currentConfiguration react to state changes.
This is like all examples I saw. For example:
BookRoutePath get currentConfiguration {
return _selectedBook == null
? BookRoutePath.home()
: BookRoutePath.details(books.indexOf(_selectedBook));
}
How can I set the property _selectedBook from some widget down the tree?
I solved that in the rest of the app using Provider and passing a ChangeNotifier.
However I am not sure how to do that with RouterDelegate.
Is there a way I can access its state?
Or is there a way I can store the state in another class and still have currentConfiguration update every time _selectedBook changes?