pushNamed method
Navigate by route name.
Implementation
Future<void> pushNamed(String name, {Map<String, String>? params}) async {
final route = _routeMap['@$name'];
if (route == null) {
if (kDebugMode) {
print('[NiceRouter] No route found with name: $name');
}
return;
}
var path = route.path;
if (params != null) {
for (final entry in params.entries) {
path = path.replaceAll(':${entry.key}', entry.value);
}
}
await push(path, params: params);
}