We’ve recently released a new package for use with all “Nav 2” implementations, called routed_widget_switcher
: https://pub.dev/packages/routed_widget_switcher
It allows you to declaratively switch child widgets based on the current Router
location:
class SideBar extends StatelessWidget { Widget build(_){ return RoutedSwitcher( builders: (info) => [ Routed('*', MainMenu.new), Routed('/dashboard', DashboardMenu.new), Routed('/settings', SettingsMenu.new), ]); } }Continue reading →