pushDeepNavigation method

Future<NavigationResult> pushDeepNavigation(
  1. T value, {
  2. bool shouldUpdateBloc = true,
})

Implementation

Future<NavigationResult> pushDeepNavigation(T value,
    {bool shouldUpdateBloc = true}) async {
  final deepNavigationStrategy =
      getDeepNavigationStrategy(currentMainNavigation);

  if (!deepNavigationStrategy.shouldAcceptNavigation(
      value, currentDeepNavigation)) {
    navigateToError(shouldUpdateBloc: shouldUpdateBloc);
    return NavigationResult.failed;
  }

  currentDeepNavigation =
      currentDeepNavigation?.setLeaf(DeepNavigationNode<T>(value)) ??
          DeepNavigationNode<T>(value);

  if (shouldUpdateBloc) {
    updateBloc();
  }
  return NavigationResult.success;
}