subscribe method
Make a State object aware of route changes.
Implementation
bool subscribe(State state) {
bool subscribed = state is RouteAware;
if (subscribed) {
final modelRoute = ModalRoute.of(state.context);
subscribed = modelRoute != null && modelRoute is PageRoute;
if (subscribed) {
// So to be informed when there are changes to route.
routeObserver.subscribe(state as RouteAware, modelRoute);
}
}
return subscribed;
}