pushPage method
Implementation
void pushPage(
BuildContext context,
AppPageNode<T> page, {
bool toParent = false,
}) {
if (toParent) {
final navState = context.findAncestorStateOfType<NavigatorState>();
if (navState == null) {
throw NavigationStackError(
'There is no Navigator in the given context. '
'Because of this a page cannot be pushed to parent navigator. '
'You can pushPage only with parameter toParent = false',
);
}
pushPage(navState.context, page);
} else {
final navState = context.findAncestorStateOfType<NavigatorState>();
final key = navState?.widget.key ?? rootNavKey;
_rootPageNodesSetter = _handleStackAction(
(currentStack) => currentStack.pushPage(page),
key,
);
notifyListeners();
}
}