isValid property
bool
isValid
Whether this HorizontalCaretMovementRun can still continue.
A HorizontalCaretMovementRun run is valid if the underlying text layout hasn't changed.
The current value and the movePrevious and moveNext methods must not be accessed when isValid is false.
Implementation
bool get isValid {
if (!_isValid) {
return false;
}
final List<MongolLineMetrics> newLineMetrics =
_editable._textPainter.computeLineMetrics();
// Use the implementation detail of the computeLineMetrics method to figure
// out if the current text layout has been invalidated.
if (!identical(newLineMetrics, _lineMetrics)) {
_isValid = false;
}
return _isValid;
}