closeUntilLast method Null safety

  1. @override
void closeUntilLast(
  1. {Map<String, Object?>? resultMap}

Close the current top most location and every location after it until the last location is visible.

resultMap of String location path to Object as result for screen.


void closeUntilLast({Map<String, Object?>? resultMap}) {
  assert(_pages.isNotEmpty, "there's no page in the stack to close");

  if (_pages.length == 1) {

  final Destination lastPageDestination = _pages.first.destination;

  closeUntil(location: lastPageDestination.path);