Interview frequency: …
Short answer
Imperative suits a quick local navigation command, while declarative describes the stack from state and is preferred when links, auth, or deep links change constantly.
Explanation
In declarative navigation, route state is the source of truth and can be rebuilt from a URL or session. Do not use a complex pattern for just one screen, and do not mix multiple sources controlling the stack without clear ownership.
Common mistakes
- Navigating from several places with differing interpretations of the auth state.
- Treating declarative as just a different API for push and pop.
Follow-up questions
- What should happen when a deep link is opened directly?
- How do you use go_router for declarative navigation, route guarding (redirect), and deep links?