popModeUntil method

  1. @override
Future<void> popModeUntil(
  1. String fullRoute, {
  2. PopMode popMode = PopMode.history,
})
override

Removes routes according to PopMode until it reaches the specifc fullRoute, DOES NOT remove the fullRoute

Implementation

@override
Future<void> popModeUntil(
  String fullRoute, {
  PopMode popMode = PopMode.history,
}) async {
  // remove history or page entries until you meet route
  var iterator = currentConfiguration;
  while (_canPop(popMode) &&
      iterator != null &&
      iterator.pageSettings?.name != fullRoute) {
    await _pop(popMode, null);
    // replace iterator
    iterator = currentConfiguration;
  }
  notifyListeners();
}