diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index e17a63a4902..227cd760c10 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -782,6 +782,10 @@ class TextPainter { offset: rect != null ? Offset(rect.left, rect.top) : _emptyOffset, fullHeight: rect != null ? rect.bottom - rect.top : null, ); + + // Cache the input parameters to prevent repeat work later. + _previousCaretPosition = position; + _previousCaretPrototype = caretPrototype; } /// Returns a list of rects that bound the given selection.