Skip to content

Commit

Permalink
Fix typo and code formatting in navigation_service
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminBelanger committed Sep 22, 2024
1 parent 6a4ca9d commit 398da73
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/features/app/navigation/navigation_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class NavigationService {
/// Will be used to report event and error.
final AnalyticsService _analyticsService = locator<AnalyticsService>();

/// Will be used to remove duplicate routes
final NavigationHistoryObserver historyObserver = NavigationHistoryObserver();
/// Will be used to remove duplicate routes.
final NavigationHistoryObserver _navigationHistoryObserver = NavigationHistoryObserver();

GlobalKey<NavigatorState> get navigatorKey => _navigatorKey;

Expand All @@ -41,7 +41,7 @@ class NavigationService {
return false;
}

/// Push a named route ([routeName] onto the navigator.
/// Push a named route [routeName] onto the navigator.
Future<dynamic> pushNamed(String routeName, {dynamic arguments}) {
final currentState = _navigatorKey.currentState;

Expand All @@ -57,7 +57,8 @@ class NavigationService {
return currentState.pushNamed(routeName, arguments: arguments);
}

/// Push a named route [routeName] onto the navigator and remove existing routes with the same [routeName]
/// Push a named route [routeName] onto the navigator
/// and remove existing routes with the same [routeName]
Future<dynamic> pushNamedAndRemoveDuplicates(String routeName, {dynamic arguments}) {
final currentState = _navigatorKey.currentState;

Expand All @@ -71,8 +72,9 @@ class NavigationService {
RouterPaths.serviceOutage, (route) => false);
}

final route = historyObserver.history.where((r) => r.settings.name == routeName).firstOrNull;

final route = _navigationHistoryObserver.history
.where((r) => r.settings.name == routeName).firstOrNull;

if (route != null) {
currentState.removeRoute(route);
}
Expand Down

0 comments on commit 398da73

Please sign in to comment.