Flutter Navigation and Routing
Flutter Navigation and Routing
In general, Flutter has some 'good techniques' that even beginners should use. Even though it is not necessary, by using the MaterialApp, you are advised to use the Navigator property and include all your app's pages. This is important for passing variables, keeping state, context and generally 'informing' the Flutter Framework what pages you have
Flutter has an imperative routing mechanism, the Navigator widget, and a more idiomatic declarative routing mechanism (which is similar to build methods as used with widgets), the Router widget.
The two systems can be used together (indeed, the declarative system is built using the imperative system).
Typically, small applications are served well by just using the Navigator API, via the MaterialApp constructor’s MaterialApp.routes property.
More elaborate applications are usually better served by the Router API, via the MaterialApp.router constructor. This requires some more up-front work to describe how to parse deep links for your application and how to map the application state to the set of active pages, but is more expressive on the long run.