delete method

bool delete(
  1. Path path, [
  2. int length = 1
])

Deletes the Nodes at the given Path.

Implementation

bool delete(Path path, [int length = 1]) {
  if (path.isEmpty || length <= 0) {
    return false;
  }
  var target = nodeAtPath(path);
  if (target == null) {
    return false;
  }
  while (target != null && length > 0) {
    final next = target.next;
    target.unlink();
    target = next;
    length--;
  }
  return true;
}