highlightLines method
void
highlightLines(
- int startIndex,
- int endIndex,
- String? color
)
Implementation
void highlightLines(int startIndex, int endIndex, String? color) {
final lines = document.collectAllStylesWithOffset(0, document.length);
int currentLine = 0;
for (final line in lines) {
if (currentLine >= startIndex && currentLine <= endIndex) {
document.format(
line.offset,
line.length ?? 0,
color == null
? Attribute.clone(Attribute.highlight, null)
: Attribute.clone(Attribute.highlight, color));
}
currentLine++;
}
notifyListeners();
}