markNeedsLayout method Null safety

void markNeedsLayout()

Marks this text painter's layout information as dirty and removes cached information.

Uses this method to notify text painter to relayout in the case of layout changes in engine. In most cases, updating text painter properties in framework will automatically invoke this method.

Implementation

void markNeedsLayout() {
  assert(() {
    if (_paragraph != null) {
      _debugMarkNeedsLayoutCallStack ??= StackTrace.current;
    }
    return true;
  }());
  _paragraph = null;
  _lineMetricsCache = null;
  _previousCaretPosition = null;
  _previousCaretPrototype = null;
}