File tree 3 files changed +13
-4
lines changed 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,15 @@ abstract class SearchDelegate<T> {
377
377
}
378
378
379
379
_SearchPageRoute <T >? _route;
380
+
381
+ /// Releases the resources.
382
+ @mustCallSuper
383
+ void dispose () {
384
+ _currentBodyNotifier.dispose ();
385
+ _focusNode? .dispose ();
386
+ _queryTextController.dispose ();
387
+ _proxyAnimation.parent = null ;
388
+ }
380
389
}
381
390
382
391
/// Describes the body that is currently shown under the [AppBar] in the
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
6
6
import 'package:flutter/material.dart' ;
7
7
import 'package:flutter/services.dart' ;
8
8
import 'package:flutter_test/flutter_test.dart' ;
9
+ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart' ;
9
10
10
11
import '../widgets/clipboard_utils.dart' ;
11
12
import '../widgets/semantics_tester.dart' ;
@@ -25,8 +26,9 @@ void main() {
25
26
TestDefaultBinaryMessengerBinding .instance.defaultBinaryMessenger.setMockMethodCallHandler (SystemChannels .platform, null );
26
27
});
27
28
28
- testWidgets ('Changing query moves cursor to the end of query' , (WidgetTester tester) async {
29
+ testWidgetsWithLeakTracking ('Changing query moves cursor to the end of query' , (WidgetTester tester) async {
29
30
final _TestSearchDelegate delegate = _TestSearchDelegate ();
31
+ addTearDown (() => delegate.dispose ());
30
32
31
33
await tester.pumpWidget (TestHomePage (delegate: delegate));
32
34
await tester.tap (find.byTooltip ('Search' ));
Original file line number Diff line number Diff line change @@ -22,9 +22,7 @@ Widget boilerplate({required Widget child}) {
22
22
23
23
void main () {
24
24
25
- testWidgetsWithLeakTracking ('SegmentedButton is built with Material of type MaterialType.transparency' ,
26
- leakTrackingTestConfig: LeakTrackingTestConfig .debugNotDisposed (),
27
- (WidgetTester tester) async {
25
+ testWidgetsWithLeakTracking ('SegmentedButton is built with Material of type MaterialType.transparency' , (WidgetTester tester) async {
28
26
final ThemeData theme = ThemeData (useMaterial3: true );
29
27
await tester.pumpWidget (
30
28
MaterialApp (
You can’t perform that action at this time.
0 commit comments