Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Navigator Basics | Navigation Fundamentals
Flutter App Foundations

Navigator Basics

Deslize para mostrar o menu

Note
Definition

The Navigator is a widget that manages a stack of route objects, enabling screen navigation in your Flutter app. Each time you move to a new screen, a new route is pushed onto the stack, and when you return, a route is popped off, revealing the previous screen.

To move between screens in Flutter, you use the Navigator.push and Navigator.pop methods. When you want to go to a new screen, you use Navigator.push, which adds a new route to the navigation stack. When you want to return to the previous screen, you use Navigator.pop, which removes the current route from the stack and reveals the previous one.

main.dart

main.dart

Use Navigator.push when you want to move forward to a new screen, such as opening a details page from a list. Use Navigator.pop when you want to return to the previous screen, such as closing a details page and going back to the main list.

main.dart

main.dart

Note
Note

The navigation stack keeps track of your route history, so each time you push a new screen, the previous screens remain underneath. Using Navigator.pop removes only the topmost route, allowing you to return to exactly where you left off.

question mark

What does Navigator.pop do in a Flutter app?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 1

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 4. Capítulo 1
some-alt