goDown method

ZipperLocation<ZR, ZI, ZS> goDown()

Move down the tree

Implementation

ZipperLocation<ZR, ZI, ZS> goDown() {
  if (!sectionP(node)) {
    throw Exception("down of item");
  }
  final t = node as ZS;
  final cs = getChildren(t);
  if (cs.isEmpty) {
    throw Exception("down of empty");
  }

  return update(
    node: cs.first,
    path: NodePath<ZS, ZR>(
      left: List<ZR>.unmodifiable([]),
      right: List<ZR>.unmodifiable(cs.skip(1)),
      parentPath: path,
      parentNode: node,
    ),
  );
}