navigateTo<T extends Object?> method
Null safety
override
Navigate to the following location
.
location
to navigate to. Must be unique in the current navigation stack.
arguments
to pass at the location.
Implementation
@override
Future<T?> navigateTo<T extends Object?>({
required final String location,
final Object? arguments,
}) async {
assert(location.trim().isNotEmpty, 'destination location is empty');
final Destination destination = Destination(
path: location,
metadata: DestinationMetadata(
arguments: arguments,
history: _pages.map((DBPage page) => page.destination).toList(),
),
);
final DBPage? newPage = await _pageBuilders.getPage(destination);
if (newPage == null) {
throw PageNotFoundException(destination);
}
_pages.add(newPage);
final Completer<T?> popTracker = Completer<T?>();
_popResultTracker[destination.path] = popTracker;
notifyListeners();
final T? result = await popTracker.future;
return result;
}