NavigationCrossroad<T>.fromBranches constructor

NavigationCrossroad<T>.fromBranches(
  1. NestedBranches<T> branches
)

Create the default navigation crossroad from NestedBranches defined in routes. The default is that every branch stack has the first AppPageNode and the active branch is based on the NestedBranches.defaultBranch.

Implementation

factory NavigationCrossroad.fromBranches(NestedBranches<T> branches) {
  return NavigationCrossroad(
    activeBranch: branches.defaultBranch,
    availableBranches: branches.branches.map(
      (key, value) => MapEntry(
        key,
        NavigationStack([AppPageNode.fromBranchInitNode(value)]),
      ),
    ),
  );
}