addToHistory method

dynamic addToHistory(
  1. ParsedRoute route
)

Implementation

addToHistory(ParsedRoute route) {
  //if (route.path == '/' || route.path == initialRoute.path) return;
  int pageNo = 0;
  if (route.parameters.containsKey('ipage')) {
    //debugPrint('pageId={_route.parameters[pageKey!]}');
    pageNo = route.parameters['ipage'] as int;
  }

  //改变当前页面号
  if (pageNo != currentTab) currentTab = pageNo;

  //这里仅仅是不等于最后,则加入历史
  if (route.path != histories[currentTab].last) {
    histories[currentTab].add(route.path);
  }

  print(
      'addHistory ${route.path},history= ${histories[0].toString()}__${histories[1].toString()}');
}