File tree 2 files changed +9
-3
lines changed 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -200,10 +200,10 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
200
200
late HorizontalDragGestureRecognizer _drag;
201
201
202
202
late AnimationController _positionController;
203
- late CurvedAnimation position;
203
+ late final CurvedAnimation position;
204
204
205
205
late AnimationController _reactionController;
206
- late Animation < double > _reaction;
206
+ late CurvedAnimation _reaction;
207
207
208
208
late bool isFocused;
209
209
@@ -424,6 +424,8 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
424
424
425
425
_positionController.dispose ();
426
426
_reactionController.dispose ();
427
+ position.dispose ();
428
+ _reaction.dispose ();
427
429
super .dispose ();
428
430
}
429
431
}
Original file line number Diff line number Diff line change @@ -14,9 +14,13 @@ import 'package:flutter/material.dart';
14
14
import 'package:flutter/rendering.dart' ;
15
15
import 'package:flutter/services.dart' ;
16
16
import 'package:flutter_test/flutter_test.dart' ;
17
+ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart' ;
17
18
18
19
void main () {
19
- testWidgets ('Switch can toggle on tap' , (WidgetTester tester) async {
20
+ testWidgets ('Switch can toggle on tap' ,
21
+ // TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
22
+ experimentalLeakTesting: LeakTesting .settings.withTracked (classes: const < String > ['CurvedAnimation' ]),
23
+ (WidgetTester tester) async {
20
24
final Key switchKey = UniqueKey ();
21
25
bool value = false ;
22
26
await tester.pumpWidget (
You can’t perform that action at this time.
0 commit comments