• In fact, just do an interface judgment, but think and did not think of, is a qualitative difference
/// NavigatorObserver
  void didPush(Route route, Route previousRoute) {
    pageInfo = route;
    super.didPush(route, previousRoute);
  }

  void didPop(Route route, Route previousRoute) {
    pageInfo = previousRoute;
    super.didPop(route, previousRoute);
  }
Copy the code
BlocProvider(
    create: (context) => DemoBloc(),
    child: BlocBuilder<DemoBloc, DemoState>(
      builder: (context, state) {
        print('isCurrent:  ${pageInfo.isCurrent}');  // only once
        return Container(child: Text(state.version.toString()),);
      },
    condition: (pre,cur){
      return pageInfo.isCurrent;  //<<-----})),Copy the code