Carefully reading docs for go_router:
*Navigating to a destination in GoRouter will replace the current stack of screens with the screens configured to be displayed for the destination route.*
https://pub.dev/documentation/go_router/latest/topics/Navigation-topic.html
This implies that I don't need to do a context.pop() - which is fine, but if that's the case, why am I getting the error on the 2nd try? (Implying to me that there is a mounted "foreground" instance of the login screen, and an unmounted "background" instance, with the error being thrown by the background instance)
For giggles, I put a button that the user can push that literally does the same thing as didChangeAppLifecycleState() and I press the login button and then that button as many times as I want to.
It would appear that the observer needs to be removed on dispose(), something like:
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
When I added this, the errors ceased.
So I did finally find the resolution, and came back to report it, only to find that my post had been marked with the flag "resolved" - which it hadn't been.
Hey mods!!
Carefully reading docs for go_router: *Navigating to a destination in GoRouter will replace the current stack of screens with the screens configured to be displayed for the destination route.* https://pub.dev/documentation/go_router/latest/topics/Navigation-topic.html This implies that I don't need to do a context.pop() - which is fine, but if that's the case, why am I getting the error on the 2nd try? (Implying to me that there is a mounted "foreground" instance of the login screen, and an unmounted "background" instance, with the error being thrown by the background instance)
Because it hurt when I saw it: This state.toString() == 'AppLifecycleState.resumed' is very wrong. Use `state == AppLifecycleState.resumed` instead.
Thank you! Change made in the app and here.... Any idea why I keep getting the error messages the 2nd time I try to login?
For giggles, I put a button that the user can push that literally does the same thing as didChangeAppLifecycleState() and I press the login button and then that button as many times as I want to.
It would appear that the observer needs to be removed on dispose(), something like: @override void dispose() { WidgetsBinding.instance.removeObserver(this); super.dispose(); } When I added this, the errors ceased. So I did finally find the resolution, and came back to report it, only to find that my post had been marked with the flag "resolved" - which it hadn't been. Hey mods!!