definitionLine method

({int line, String path})? definitionLine(
  1. int line
)

Where a line of the site's definitions is written: line of definitionText as its file and the line in it; null past the end.

Implementation

({String path, int line})? definitionLine(int line) {
  var at = line;
  for (final e in definitionFiles.entries) {
    final n = const LineSplitter().convert(e.value).length + (e.value.endsWith('\n') ? 1 : 0);
    if (at <= n) return (path: e.key, line: at);
    at -= n;
  }
  return null;
}