Skip to content

Commit 0f54362

Browse files
committed
fix(headlines-feed): ensure super.build is called first in _HeadlinesFeedPageState
- Move super.build(context) to the beginning of the build method - Remove redundant super.build calls elsewhere in the method - Add comments explaining the importance of calling super.build first
1 parent 861bfd8 commit 0f54362

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage>
106106

107107
@override
108108
Widget build(BuildContext context) {
109+
// The call to super.build(context) must be the first statement in the build
110+
// method when using AutomaticKeepAliveClientMixin.
111+
super.build(context);
109112
final l10n = AppLocalizationsX(context).l10n;
110113
final theme = Theme.of(context);
111114

@@ -129,7 +132,6 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage>
129132
// This handles the brief period after authentication but before
130133
// the remote config is fetched, preventing null access errors.
131134
if (appBlocState.remoteConfig == null) {
132-
super.build(context);
133135
return LoadingStateWidget(
134136
icon: Icons.settings_applications_outlined,
135137
headline: l10n.headlinesFeedLoadingHeadline,
@@ -160,7 +162,6 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage>
160162
);
161163
}
162164

163-
super.build(context);
164165
return RefreshIndicator(
165166
onRefresh: () async {
166167
context.read<HeadlinesFeedBloc>().add(

0 commit comments

Comments
 (0)