Skip to content

Commit 1527da6

Browse files
Philclaude
andcommitted
test: guard inline config() through a hot reload (flutter/flutter#127206)
With the router kept in a field and config() called inline in MaterialApp.router, reassembling the app as a hot reload does keeps the stack and the pages' State. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5463704 commit 1527da6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎auto_route/test/inline_router_config_test.dart‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ void main() {
6464
await tester.pumpAndSettle();
6565
expectStackAndStateKept();
6666
});
67+
68+
// flutter/flutter#127206: go_router asked how to handle a router config
69+
// created inline in MaterialApp.router, which a hot reload builds again.
70+
// With the router kept in a field, a hot reload keeps the stack and state.
71+
// Steps: push CounterRoute, count to 1, then reassemble the app as a hot
72+
// reload does.
73+
// Should: the stack and the page's State are kept.
74+
testWidgets('config() called inline keeps the stack and page state through a hot reload', (tester) async {
75+
await pumpInlineConfigApp(tester);
76+
unawaited(tester.binding.reassembleApplication());
77+
await tester.pumpAndSettle();
78+
expectStackAndStateKept();
79+
});
6780
}
6881

6982
class _CounterPage extends StatefulWidget {

0 commit comments

Comments
 (0)