Skip to content

Commit bd1d5ec

Browse files
authored
docs(firebase_ui_auth): Handle UserCreated event in README example (#422)
1 parent 0e3a7c4 commit bd1d5ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/firebase_ui_auth/README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,23 @@ class MyApp extends StatelessWidget {
4444
Widget build(BuildContext context) {
4545
final providers = [EmailAuthProvider()];
4646
47+
void onSignedIn() {
48+
Navigator.pushReplacementNamed(context, '/profile');
49+
}
50+
4751
return MaterialApp(
4852
initialRoute: FirebaseAuth.instance.currentUser == null ? '/sign-in' : '/profile',
4953
routes: {
5054
'/sign-in': (context) {
5155
return SignInScreen(
5256
providers: providers,
5357
actions: [
58+
AuthStateChangeAction<UserCreated>((context, state) {
59+
// Put any new user logic here
60+
onSignedIn();
61+
}),
5462
AuthStateChangeAction<SignedIn>((context, state) {
55-
Navigator.pushReplacementNamed(context, '/profile');
63+
onSignedIn();
5664
}),
5765
],
5866
);

0 commit comments

Comments
 (0)