Bidev

Navigation & Routing Flutter Interview Questions

7 questions

IntermediateNavigation & Routing

How do you intercept the back button in Flutter?

Wrap the screen in a PopScope widget (the modern replacement for the deprecated WillPopScope), setting canPop to false and handling the back attempt in the pop callback — commonly used for an 'unsaved changes' confirmation dialog.

AdvancedNavigation & Routing

What's the difference between Navigator 1.0 and Navigator 2.0?

Navigator 1.0 is imperative — you push/pop routes as commands; Navigator 2.0 is declarative — you describe the current stack of pages as a list derived from app state, which is what enables deep linking and browser back-button support to work correctly.

IntermediateNavigation & Routing

How does go_router simplify navigation in Flutter?

go_router lets you define your app's routes as a declarative table mapping URL paths to pages, handling deep linking, web URL sync, and nested/shell routes without writing raw Navigator 2.0 boilerplate.

BeginnerNavigation & Routing

Should you use named routes or MaterialPageRoute directly?

Named routes work well for simple, static navigation with no arguments; MaterialPageRoute pushed directly is more flexible for passing complex objects — though most new apps reach for go_router instead of either.

AdvancedNavigation & Routing

How does deep linking work in Flutter?

Deep linking means the OS can open your app directly to a specific screen from an external URL or link tap, requiring platform-level configuration (Android intent filters, iOS Universal Links) in addition to in-app routing logic mapping the incoming URL to the right screen.

AdvancedNavigation & Routing

How do you implement nested navigation in Flutter (e.g. a bottom nav bar with separate stacks per tab)?

Give each tab its own Navigator with a unique key, so each tab maintains an independent back stack, and wrap it in an IndexedStack to preserve each tab's state when switching between them.

BeginnerNavigation & Routing

How do you return data from a screen when popping it?

Pass a value to Navigator.pop(context, value), and await the result of the original Navigator.push call — the awaited Future resolves with whatever value was passed to pop.