updateChildren method

  1. @override
MatrixNode updateChildren(
  1. covariant List<EquationRowNode> newChildren
)
override

Return a copy of this node with new children.

Subclasses should override this method. This method provides a general interface to perform structural updates for the green tree (node replacement, insertion, etc).

Please ensure children works in the same order as updateChildren, computeChildOptions, and buildWidget.

Implementation

@override
MatrixNode updateChildren(List<EquationRowNode> newChildren) {
  assert(newChildren.length >= rows * cols);
  var body = List<List<EquationRowNode>>.generate(
    rows,
    (i) => newChildren.sublist(i * cols + (i + 1) * cols),
    growable: false,
  );
  return copyWith(body: body);
}