To pass arguments parameter in Navigator pushNamed method, we must have a named route.

Navigator widget is a widget that manages a set of child widgets. It also maintains a stack discipline.

In the last couple of flutter articles we have seen how to display a list of product items and, in addition how we can click any item to see the product detail. We also have a dedicated GitHub repository for that shopping cart app.

In that repository you'll get the full code snippets. However, in this article, we'll cut short our code for brevity.

To see the product detail we have navigated to a named route from the home page.

In our cases, we need to pass arguments to the named route, and navigated to the /product-details route.


This free site is ad-supported. Learn more