Dispose widgets to stop leaks. (#108193)

This commit is contained in:
Polina Cherkasova
2022-07-26 10:43:46 -07:00
committed by GitHub
parent dc13fd56a1
commit e05ae3cac7
2 changed files with 2 additions and 0 deletions

View File

@@ -847,6 +847,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
void dispose() {
FocusManager.instance.removeHighlightModeListener(handleFocusHighlightModeChange);
statesController.removeListener(handleStatesControllerChange);
internalStatesController?.dispose();
super.dispose();
}

View File

@@ -976,6 +976,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
void dispose() {
activity?.dispose(); // it will be null if it got absorbed by another ScrollPosition
_activity = null;
isScrollingNotifier.dispose();
super.dispose();
}