setNewRoutePath method
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(RoutePath configuration) async {
logger.d('setNewRoutePath executed.');
if (configuration.routeName != (_routePath?.routeName ?? '')) {
logger.i('set new routePath = ' + configuration.routeName);
handler.changeRoutePath(configuration);
routeInformationProvider.routerReportsNewRouteInformation(
configuration.getRouteInstance.getRouteInformation());
}
_routePath = configuration;
///
/// Prevent path has change but router has move to new page.
///
if (_navigatorRoutePath != _routePath) {
_navigatorRoutePath = _routePath;
navigatorKey.currentState?.pushNamed(_routePath?.path ?? '');
}
// logger.i('_routePathListeners = ' + _routePathListeners.toString());
///
/// execute listeners
///
for (var e in _routePathListeners.values) {
e(configuration);
}
notifyListeners();
}