Navigator(
key: navigatorKey,
// 通过一个list来保存的 但其实还是一个栈的结构 只不过我们能通过list的特性来交换里面页面的顺序
pages: List.of(_pages),
//Called when [pop] is invoked but the current [Route] corresponds to a [Page] found in the [pages] list.
onPopPage: _onPopPage,
);
bool _onPopPage(Route route, dynamic result){
if(!route.didPop(result)) return false;
if(_canPop()){
_pages.removeLast();
return true;
} else {
return false;
}
}
Navigator.pop(context,true) 或 我们自定义的 router.popRoute 时候调用的吗?