push method

Future<void> push(
  1. String path, {
  2. Map<String, String>? params,
})

Navigate to a path.

Implementation

Future<void> push(String path, {Map<String, String>? params}) async {
  final matchedRoute = _matchRoute(path);
  if (matchedRoute == null) {
    if (kDebugMode) {
      print('[NiceRouter] No route found for path: $path');
    }
    return;
  }

  // Run guard if present
  // Note: Context is not available here, would need to be passed in
  // Simplified for this implementation

  _history.add(_currentPath);
  _currentPath = path;
  _currentParams = params ?? _extractParams(path, matchedRoute.path);
  notifyListeners();
}