sync method

void sync({
  1. bool force = false,
})

Recomputes range decorations from the controller's current text.

Implementation

void sync({bool force = false}) {
  if (_disposed) return;
  if (isActive != null && !isActive!()) {
    return;
  }
  final text = _controller.text;
  if (!force && text == _lastText) {
    return;
  }
  _lastText = text;
  final decorations = _buildDecorations(text).toList(growable: false);
  if (decorations.isEmpty) {
    _controller.clearDecorationLayer(layerKey);
    return;
  }
  _controller.setDecorationLayer(layerKey, decorations, priority: priority);
}