popModeUntil method
Removes routes according to PopMode
until it reaches the specific fullRoute
,
DOES NOT remove the fullRoute
Implementation
@override
Future<void> popModeUntil(
String fullRoute, {
PopMode popMode = PopMode.history,
}) async {
// Remove history or page entries until we reach the target route
var iterator = currentConfiguration;
// Keep popping until we can't pop anymore or we find the target route
while (iterator != null && _canPop(popMode)) {
// Check if we've reached the target route
// Note: This check is outside the while condition to avoid WASM compile errors
// See: https://github.com/flutter/flutter/issues/140110
if (iterator.pageSettings?.name == fullRoute) {
break;
}
// Pop one level and update our iterator to the new configuration
await _pop(popMode, null);
iterator = currentConfiguration;
}
// Notify listeners about the navigation changes
notifyListeners();
}