Coming from a web background (angular), I'm really confused about flutter routing.
It seems like I'm not alone (1, 2, ...).
Judging by the relative complexity of the answers and the various bugs associated with some of them, I'm wondering if I'm just trying to use the navigator as something it is not. I'm trying to use it like I would use a router of a web framework. If the routing in flutter is intended to change a whole screen and not children widgets.
On the Web the following navigation would be something like this:
{ path: '/sign-in', widget: SignInPage() },
{ path: '/', widget: HomePage(), children: [
{ path: '/a', widget: DashboardPage() },
{ path: '/b', widget: ProfilePage(), children: [
{ path: '/general', widget: BGeneralPage() },
{ path: '/settings', widget: BSettingsPage() },
] }
] }
// example url x.com/b/settings
In flutter you can put a nested Navigator, but the hot reloading seem to fail, also the default animation is quite junky. Even the documentation on nested navigation says << a similar result is possible using only a single Navigator >>.
It looks to me like that the routing system is intended to be used when we want to change the whole screen. PageView and TabBarView are the widgets to use for inner navigation.
- Is it the case ?
However, I see a potential problem with that when flutter web will be available it won't have matching urls.