onRoute function

void onRoute(
  1. dynamic function()
)

Binds the function to a router event.

Implementation

void onRoute(Function() function) {
  window.addEventListener(routerEvent, (event) => function.call());
}