setNewRoutePath method

  1. @override
Future<void> setNewRoutePath(
  1. TabShellRoutePath configuration
)
override

Convert navigation state into app state.

This is where all your logic should take place: verifying that the user can access what he/she is trying to access, redirecting if needed.

Implementation

@override
Future<void> setNewRoutePath(TabShellRoutePath configuration) async {
  for (int i = 0; i < tabs.length; i++) {
    TabDefinition tabDefinition = tabs.elementAt(i);
    if (tabDefinition.route == configuration.route) {
      tabController.index = i;
      return;
    }
  }
  tabController.index = 0;
}