popUntilPath method

void popUntilPath(
  1. String path
)

Pops routes until the given path is reached

Implementation

void popUntilPath(String path) {
  try {
    final context = _currentContext;
    if (context == null) {
      if (_enableLogger) {
        debugPrint('NavService.popUntilPath: No valid context found.');
      }
      return;
    }

    Navigator.of(context).popUntil((route) => route.settings.name == path);
    // ignore: avoid_catches_without_on_clauses
  } catch (e, st) {
    if (_enableLogger) {
      debugPrint('NavService.popUntilPath.exception: $e\n$st');
    }
  }
}