@@ -364,7 +364,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
364
364
_readOnly = readOnly,
365
365
_forceLine = forceLine,
366
366
_clipBehavior = clipBehavior,
367
- _hasFocus = hasFocus ?? false {
367
+ _hasFocus = hasFocus ?? false ,
368
+ _disposeShowCursor = showCursor == null {
368
369
assert (! _showCursor.value || cursorColor != null );
369
370
370
371
_selectionPainter.highlightColor = selectionColor;
@@ -405,6 +406,10 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
405
406
_selectionPainter.dispose ();
406
407
_caretPainter.dispose ();
407
408
_textPainter.dispose ();
409
+ if (_disposeShowCursor) {
410
+ _showCursor.dispose ();
411
+ _disposeShowCursor = false ;
412
+ }
408
413
super .dispose ();
409
414
}
410
415
@@ -879,6 +884,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
879
884
_caretPainter.backgroundCursorColor = value;
880
885
}
881
886
887
+ bool _disposeShowCursor;
888
+
882
889
/// Whether to paint the cursor.
883
890
ValueNotifier <bool > get showCursor => _showCursor;
884
891
ValueNotifier <bool > _showCursor;
@@ -889,6 +896,10 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
889
896
if (attached) {
890
897
_showCursor.removeListener (_showHideCursor);
891
898
}
899
+ if (_disposeShowCursor) {
900
+ _showCursor.dispose ();
901
+ _disposeShowCursor = false ;
902
+ }
892
903
_showCursor = value;
893
904
if (attached) {
894
905
_showHideCursor ();
0 commit comments