Navigator is a component of both MaterialApp and CupertinoApp. Accessing this object is yet another example of the of-context pattern. Internally, Navigators function as a stack. Routes can be pushed onto the stack and popped off the stack.
Normally, you would just use the standard push() and pop() methods to add and remove routes, but as we discussed in this recipe, we didn't just want to push StopWatch onto the screen – we also wanted to pop LoginScreen from the stack at the same time. To accomplish this, we used the pushReplacement method:
Navigator.of(context).pushReplacement(
MaterialPageRoute(
We also used the MaterialPageRoute class to represent our routes. This object will create a platform-aware transition between the two screens. On iOS, it will push onto the screen from right, while on Android, it will pop onto the screen from the bottom.
Similar to ListView...