File tree Expand file tree Collapse file tree
packages/flutter_test/lib/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1988,6 +1988,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
19881988 bool _pendingInvariantVerification = false ;
19891989
19901990 /// Defers invariant verification until [verifyInvariantsAfterTestTearDown] .
1991+ ///
1992+ /// This is used by [testWidgets] , which can install package:test tearDown
1993+ /// callbacks around [runTest] . Direct [runTest] callers still verify
1994+ /// invariants before [postTest] .
19911995 @protected
19921996 void deferInvariantsUntilAfterTestTearDown () {
19931997 _verifyInvariantsAfterTestTearDown = true ;
Original file line number Diff line number Diff line change @@ -180,7 +180,10 @@ void testWidgets(
180180 if (semanticsEnabled) {
181181 semanticsHandle = tester.ensureSemantics ();
182182 }
183- // Invariant verification must run after user addTearDown callbacks and before postTest.
183+ // testWidgets owns the package:test tearDown callbacks, so it can
184+ // defer binding invariant verification until after user addTearDown
185+ // callbacks and before postTest. Lower-level binding.runTest callers
186+ // keep the immediate invariant check inside runTest.
184187 // ignore: invalid_use_of_protected_member
185188 binding.deferInvariantsUntilAfterTestTearDown ();
186189 test_package.addTearDown (binding.postTest);
You can’t perform that action at this time.
0 commit comments