I want to navigate to another page if the user is not signed in. I've tried to add this code to the initState but I can't use navigation at this stage of the lifecycle. Is there another option?
This won't work in the constructors of the StatefulWidget or State either. From what it looks like I have to control the routing.
// Where can I apply this code.
if (auth.currentUser == null) {
Navigator.of(context).pushNamed(SignInPage.routeName);
}