popUntil method

void popUntil(
  1. String value,
  2. {bool exactMatch = false}
)

Pop all pages until we find a match

Implementation

void popUntil(String value, {bool exactMatch = false}) {
  int index = history.lastIndexWhere((element) => exactMatch ? element == value : element.contains(value));
  List<String> newHistory = List.from(history)..removeRange(index + 1, history.length);
  path = newHistory.last;
  history = newHistory;
}