toName<T> method
Go to a route with given name
and params
Set ignoreSamePath
to true to ignore the navigation if the current path
is the same as the route path
Use pageAlreadyExistAction to define what to do when
page already is in the stack you can remove the page
or just bring it to the top
Implementation
Future<T?> toName<T>(
String name, {
Map<String, dynamic>? params,
bool ignoreSamePath = true,
PageAlreadyExistAction? pageAlreadyExistAction,
bool waitForResult = false,
}) async {
if (ignoreSamePath && isCurrentName(name, params: params)) {
return null;
}
final controller = _manager.withName(QRContext.rootRouterName);
var match = await controller.findName(name, params: params);
await _toMatch(match, pageAlreadyExistAction: pageAlreadyExistAction);
if (waitForResult) return match.getFuture();
return null;
}