📱 Flutter
Intermediate
What is Navigator in Flutter?
Answer
The Navigator manages a stack of routes (screens) in a Flutter app. Navigator.push() pushes a new route on top of the stack (navigates forward), and Navigator.pop() removes the top route (navigates back). Navigator.pushReplacement() replaces the current route — useful for the login → home transition so the user cannot go back to login. For named routes, use Navigator.pushNamed(context, "/home"). Flutter 2.0 introduced the Navigator 2.0 (Router) API for URL-based navigation.