highlight method

TerminalLibraryFlutterHighlight highlight({
  1. required CellAnchor p1,
  2. required CellAnchor p2,
  3. required Color color,
})

Creates a new highlight on the terminal from p1 to p2 with the given color. The highlight will be removed when the returned object is disposed.

Implementation

TerminalLibraryFlutterHighlight highlight({
  required CellAnchor p1,
  required CellAnchor p2,
  required Color color,
}) {
  final highlight = TerminalLibraryFlutterHighlight(
    this,
    p1: p1,
    p2: p2,
    color: color,
  );

  _highlights.add(highlight);
  notifyListeners();

  highlight.registerCallback(() {
    _highlights.remove(highlight);
    notifyListeners();
  });

  return highlight;
}