void routeChanged(
bool visible,
List<String> params
)

Implement this callback in your element.

will be invoked each time when: your element is invisible and should become visible your element is visible and should become invisible your element is visible and should stay visible, but params changed (see Routing parameters above)

Source

void routeChanged(bool visible, List<String> params) {
  if (visible) {
    toggleAttribute("router-visible", true);
  } else {
    toggleAttribute("router-visible", false);
  }

}