Flutter: Move to a new screen without back
I'm implementing an authentication flow in my Flutter app. After a sign in attempt, the CheckAuth (which checks whether a user is signed in or not and then opens home screen or sign up screen accordingly) is opened with this code: void _signIn() async { await _auth .signInWithEmailAndPassword( email: _userEmail.trim(), password: _userPassword.trim()) .then((task) { // go to home screen if (task.getIdToken() != null) { setState(() { Navigator.pushReplacement( context, new MaterialPageRoute( builder: (BuildContext context) => new CheckAuth())); }); } else { print("Authentication failed"); } });