Cache caret parameters (#38821)
diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart
index e17a63a..227cd76 100644
--- a/packages/flutter/lib/src/painting/text_painter.dart
+++ b/packages/flutter/lib/src/painting/text_painter.dart
@@ -782,6 +782,10 @@
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.