Detect pushed routes on Flutter

后端 未结 2 862
长情又很酷
长情又很酷 2021-01-27 21:09

How can I check if a named route is currently on the stack? I do not want to build a new route every time the user pushes a named route that already exists.

Also, is the

2条回答
  •  旧巷少年郎
    2021-01-27 21:39

    https://docs.flutter.io/flutter/widgets/RouteObserver-class.html allows you to listen to route changes and maintain a copy of the stack yourself where you can look up existing routes.

    You can also upvote this issue https://github.com/flutter/flutter/pull/22408 that exposes the history stack.

提交回复
热议问题