From 59bc6f3f3fffa6ea62f47d4f2f7d6f04e974d371 Mon Sep 17 00:00:00 2001 From: Ellet Date: Thu, 29 Jan 2026 16:32:35 +0300 Subject: [PATCH] docs(readme): use a valid BuildContext in onSignedIn() to navigate correctly The current code snippet in the README does not function after logging in with any authentication provider and will produce a runtime error. This is due to using `Navigator` with the root widget's `BuildContext`, which lacks the details required to navigate to the profile screen, which is only known in a `BuildContext` that is under `MaterialApp`. --- packages/firebase_ui_auth/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/firebase_ui_auth/README.md b/packages/firebase_ui_auth/README.md index c4e0d070f..1d85e1d7f 100644 --- a/packages/firebase_ui_auth/README.md +++ b/packages/firebase_ui_auth/README.md @@ -44,7 +44,7 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { final providers = [EmailAuthProvider()]; - void onSignedIn() { + void onSignedIn(BuildContext context) { Navigator.pushReplacementNamed(context, '/profile'); } @@ -57,10 +57,10 @@ class MyApp extends StatelessWidget { actions: [ AuthStateChangeAction((context, state) { // Put any new user logic here - onSignedIn(); + onSignedIn(context); }), AuthStateChangeAction((context, state) { - onSignedIn(); + onSignedIn(context); }), ], );