Flutter has an imperative routing mechanism, the
and a more idomatic declarative routing mechanism (which is similar to
build methods as used with widgets), the
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
More elaborate applications are usually better served by the
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.
To learn about
Router and the declarative approach, see Learning
Flutter’s new navigation and routing system, and the