routerReportsNewRouteInformation method

  1. @override
void routerReportsNewRouteInformation(
  1. RouteInformation routeInformation, {
  2. required RouteInformationReportingType type,
})
override

A callback called when the Router widget reports new route information

The subclasses can override this method to update theirs values or trigger other side effects. For example, the PlatformRouteInformationProvider overrides this method to report the route information back to the engine.

The routeInformation is the new route information generated by the Router rebuild, and it can be the same or different from the value.

The type denotes the Router's intention when it reports this routeInformation. It is useful when deciding how to update the internal state of RouteInformationProvider subclass with the routeInformation. For example, PlatformRouteInformationProvider uses this property to decide whether to push or replace the browser history entry with the new routeInformation.

For more information on how Router determines a navigation event, see the "URL updates for web applications" section in the Router documentation.

Implementation

@override
void routerReportsNewRouteInformation(RouteInformation routeInformation,
    {required RouteInformationReportingType type}) {
  log.info(
      "platform:didPushRouteInformation: ${routeInformation.location} ${routeInformation.runtimeType}");
  return super.routerReportsNewRouteInformation(routeInformation, type: type);
}