setNewRoutePath method

  1. @override
Future<void> setNewRoutePath(
  1. AppScreenRoutePath path
)
override

Called by the Router when the Router.routeInformationProvider reports that a new route has been pushed to the application by the operating system.

Consider using a SynchronousFuture if the result can be computed synchronously, so that the Router does not need to wait for the next microtask to schedule a build.

Implementation

@override
Future<void> setNewRoutePath(AppScreenRoutePath path) async {
  if (path.is_unknown) {
    _selected_app_screen = null;
    show_404 = true;
    return;
  }

  if (path.is_details_page) {
    AppScreen app_screen = app_screens.singleWhere(
        (current_app_screen) => current_app_screen.name == path.name);

    _selected_app_screen = app_screen;
  } else {
    _selected_app_screen = null;
  }

  show_404 = false;
}