Navigation

Moving between different pages in your app.

Flutter uses a
Navigator widget that manages a stack of
Route objects. To go to a new screen, you
push a new route onto the stack. To go back, you
pop the current route. For complex apps with named routes, packages like
go_router are highly recommended.

Code Example

// Navigate to a new screen
Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => DetailScreen()),
);

// Go back to the previous screen
Navigator.pop(context);