remove method

bool remove(
  1. String id
)

Removes a managed page by snapshot ID, completing its push with null.

Updates the declarative stack and replaces the browser history entry. Returns false for an unknown ID or the sole remaining page. This is not a pop attempt and does not consult PopScope. Throws after disposal.

Implementation

bool remove(String id) {
  _checkAlive();
  final matches = _entries.where((entry) => entry.location.id == id);
  if (matches.isEmpty || _entries.length == 1) return false;
  _removeEntry(matches.first, NavigationAction.remove);
  return true;
}