Fix memory leak in Form (#132987)

Diposes some restorable variables that weren't disposed before.
This commit is contained in:
Justin McCandless 2023-08-22 10:23:13 -07:00 committed by GitHub
parent b3005a318b
commit 0278671bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -573,6 +573,13 @@ class FormFieldState<T> extends State<FormField<T>> with RestorationMixin {
super.deactivate();
}
@override
void dispose() {
_errorText.dispose();
_hasInteractedByUser.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (widget.enabled) {

View File

@ -247,9 +247,6 @@ void main() {
},
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.linux, TargetPlatform.windows }),
skip: kIsWeb, // [intended] we don't supply the cut/copy/paste buttons on the web.
// TODO(polina-c): remove after fixing
// https://github.com/flutter/flutter/issues/130467
leakTrackingTestConfig: const LeakTrackingTestConfig(allowAllNotDisposed: true, allowAllNotGCed: true),
);
testWidgetsWithLeakTracking(