diff --git a/web/docs/guides/with-flutter.mdx b/web/docs/guides/with-flutter.mdx index c7534953388..e98b7082bd1 100644 --- a/web/docs/guides/with-flutter.mdx +++ b/web/docs/guides/with-flutter.mdx @@ -299,7 +299,10 @@ class AuthRequiredState @override void onUnauthenticated() { /// Users will be sent back to the LoginPage if they sign out. - Navigator.of(context).pushNamedAndRemoveUntil('/login', (route) => false); + if (mounted) { + /// Users will be sent back to the LoginPage if they sign out. + Navigator.of(context).pushNamedAndRemoveUntil('/login', (route) => false); + } } } ``` @@ -527,7 +530,6 @@ class _AccountPageState extends AuthRequiredState { if (error != null) { context.showErrorSnackBar(message: error.message); } - Navigator.of(context).pushReplacementNamed('/login'); } @override @@ -538,11 +540,6 @@ class _AccountPageState extends AuthRequiredState { } } - @override - void onUnauthenticated() { - Navigator.of(context).pushReplacementNamed('/login'); - } - @override void dispose() { _usernameController.dispose();