scrollToLine method
Scrolls the editor view to make the specified line visible.
line is zero-indexed (0 for the first line). The editor will scroll
vertically to bring the specified line into view, centering it if possible.
If the line is within a folded region, the fold will be expanded first to make the line visible.
Throws StateError if the editor has not been initialized.
Throws RangeError if line is out of bounds.
Example:
// Scroll to line 50 (1-indexed line 51)
controller.scrollToLine(50);
// Scroll to the first line
controller.scrollToLine(0);
Implementation
void scrollToLine(int line) {
if (_scrollToLineCallback == null) {
throw StateError('Editor is not initialized');
}
if (line < 0 || line >= lineCount) {
throw RangeError.range(line, 0, lineCount - 1, 'line');
}
_scrollToLineCallback!(line);
}