File tree 2 files changed +21
-0
lines changed 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
244
244
/// If [registerTestTextInput] returns true when this method is called,
245
245
/// the [testTextInput] is configured to simulate the keyboard.
246
246
void reset () {
247
+ _restorationManager? .dispose ();
247
248
_restorationManager = null ;
248
249
resetGestureBinding ();
249
250
testTextInput.reset ();
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import 'package:flutter_test/flutter_test.dart' ;
6
+
7
+ void main () {
8
+ test ('Disposes restoration manager on reset.' , () {
9
+ final AutomatedTestWidgetsFlutterBinding binding = AutomatedTestWidgetsFlutterBinding ();
10
+ int oldCounter = 0 ;
11
+ final TestRestorationManager oldRestorationManager = binding.restorationManager;
12
+ oldRestorationManager.addListener (() => oldCounter++ );
13
+
14
+ oldRestorationManager.notifyListeners ();
15
+ expect (oldCounter, 1 );
16
+
17
+ binding.reset ();
18
+ expect (oldRestorationManager.notifyListeners, throwsA ((Object e) => e.toString ().contains ('disposed' )));
19
+ });
20
+ }
You can’t perform that action at this time.
0 commit comments