Flutter & Dart (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
How does Navigation work in Flutter (Navigator 1.0 vs Navigator 2.0 / GoRouter)?
senior LevelRoutingSystem Design
In Simple Words:
- Navigator 1.0 (Imperative): Simple
Navigator.push()andpop(). Great for basic mobile apps, but struggles with deep linking and web browser history. - Navigator 2.0 (Declarative): Pages are declared as a list based on application state.
- GoRouter (Official Recommendation): Simplifies Navigator 2.0 using clean, declarative URL routing, route redirection (auth guards), nested shell routes (bottom tab navigation), and deep linking out of the box.