navigate method
void
navigate(
Implementation
void navigate(BuildContext buildContext, String routeName, Map<String, String> data) {
try {
// we need to add this route to the first navigator above the root Beagle navigator
final rootNavigator = buildContext.findAncestorStateOfType<RootNavigatorState>();
// if, for some reason, the root Beagle navigator is not available, use the first navigator in the context
final targetNavigator = Navigator.of(rootNavigator == null ? buildContext : rootNavigator.context);
targetNavigator.pushNamed(routeName, arguments: data);
} catch (err) {
final logger = findBeagleService(buildContext).logger;
logger.error('Error: $err while trying to navigate to $routeName');
}
}