Flutter

Navigation & Routing

Navigator 1.0/2.0, routes, MaterialPageRoute, Router API, go_router, deep linking, named routes

22 Interview-Fragen·
Mid-Level
1

Which method should be used to navigate to a new screen with Navigator 1.0?

Antwort

Navigator.push() adds a new route to the navigation stack, allowing navigation to a new screen while keeping the previous screen in the stack. This method takes context and a Route (usually MaterialPageRoute) as parameters. Push stacks the new route, while pop removes it from the stack.

2

What does Navigator.pop() return when sending data back to the previous screen?

Antwort

Navigator.pop() can take an optional argument that will be returned to the previous screen via the Future returned by Navigator.push(). This allows sending a result (confirmation, selection, modified data) back to the screen that initiated navigation. Use await with push() to retrieve this result.

3

What is the role of MaterialPageRoute in Flutter navigation?

Antwort

MaterialPageRoute is a route that uses Material Design transitions (slide from right on iOS, fade on Android). It takes a builder that returns the destination widget. It automatically handles transition animations and respects platform conventions for a native user experience.

4

How to define named routes in a Flutter application?

5

What is the difference between Navigator.pushReplacement() and Navigator.push()?

+19 Interview-Fragen

Meistere Flutter für dein nächstes Interview

Zugang zu allen Fragen, Flashcards, technischen Tests, Code-Review-Übungen und Interview-Simulatoren.

Kostenlos starten