close<T extends Object?> method
Null safety
- [T? result]
override
Close the current top most location.
result
to return when the location is closed.
result
is the value by which navigateTo future complete.
Implementation
@override
void close<T extends Object?>([final T? result]) {
assert(_pages.isNotEmpty, "there's no page in the stack to close");
assert(_pages.length > 1, "You can't remove the only page in the stack");
final DBPage topPage = _pages.removeAt(_pages.length - 1);
final Completer<Object?>? tracker = _popResultTracker.remove(
topPage.destination.path,
);
if (tracker != null && !tracker.isCompleted) {
tracker.complete(result);
}
notifyListeners();
}