analytics_flutter
analytics_flutter copied to clipboard
Issue in ScreenObserver
In the didPop
function inside the ScreenObserver
is an issue.
the code:
@override
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
final name = route.settings.name;
if (name != null) {
screenStreamController.add(name);
}
}
From the documentation from didPop
:
The Navigator popped route.
The route immediately below that one, and thus the newly active route, is previousRoute.
Copied from NavigatorObserver.
Therefore the code should be:
@override
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
final name = previousRoute.settings.name;
if (name != null) {
screenStreamController.add(name);
}
}
previousRoute
is the new route, and therefore that is the name which should be tracked, not route
.