appendToList method

void appendToList(
  1. Iterable<Object?> path,
  2. Object? value
)

Appends value to the list at path.

Throws a ArgumentError if the element at the given path is not a YamlList or if the path is invalid.

Throws an AliasException if a node on path is an alias or anchor.

Example:

final doc = YamlEditor('[0, 1]');
doc.appendToList([], 2); // [0, 1, 2]

Implementation

void appendToList(Iterable<Object?> path, Object? value) {
  final yamlList = _traverseToList(path);

  insertIntoList(path, yamlList.length, value);
}