didPush method

  1. @override
void didPush(
  1. Route route,
  2. Route? previousRoute
)
override

Called when a route is pushed onto the navigator.

The route parameter represents the route being pushed onto the navigator. The previousRoute parameter represents the route that was previously on top of the navigator.

Implementation

@override
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
  WidgetsBinding.instance.addPostFrameCallback((_) {
    final endTime = DateTime.now().millisecondsSinceEpoch;
    final int duration = endTime - Tealeaf.startTime;

    /// Calls Tealeaf plugin
    PluginTealeaf.logScreenLayout(route.settings.name.toString());

    tlLogger
        .v('PluginTealeaf.logScreenLayout - Pushed ${route.settings.name}');

    PluginTealeaf.logPerformanceEvent(
      loadEventStart: 0,
      loadEventEnd: duration,
    );
  });
}