eachLine method

void eachLine(
  1. LineHandler callback, {
  2. int? start,
  3. int? end,
})

Iterate over the whole document, or if start and end line numbers are given, the range from start up to (not including) end, and call f for each line, passing the line handle. This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. Note that line handles have a text property containing the line's content (as a string).

Implementation

void eachLine(LineHandler callback, {int? start, int? end}) {
  start ??= firstLine();
  end ??= lastLine()! + 1;
  callArgs('eachLine', [
    start,
    end,
    (JsObject line) {
      callback(LineHandle(line));
    }
  ]);
}