Skip to content
Back to skills

Navigator V1 Navigation

ASecurity

Standard Flutter navigation using Navigator 1.0 (push/pop).

  • 8 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 8, 2026
ai-agents

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add ngxtm/devkit --skill navigator-v1-navigation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Navigator V1 Navigation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Navigator V1 Navigation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ngxtm-navigator-v1-navigation/badge)](https://www.skillsdirectory.com/skills/ngxtm-navigator-v1-navigation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Flutter Navigator v1 (Imperative)
description: Standard Flutter navigation using Navigator 1.0 (push/pop).
metadata:
  labels: [navigation, navigator, flutter-core]
  triggers:
    files: ['**/app.dart']
    keywords: [Navigator, push, pop, MaterialPageRoute, onGenerateRoute]
---

# Navigator v1 Navigation

## **Priority: P0 (CRITICAL)**

Standard imperative navigation system built into Flutter using `Navigator` and `MaterialPageRoute`.

## Implementation Guidelines

- **Standard Push**: Use `Navigator.of(context).push(MaterialPageRoute(builder: (_) => Screen()))`.
- **Named Routes**: Define `routes` map in `MaterialApp` or use `onGenerateRoute` for dynamic routing.
- **Passing Arguments**:
  - For named routes: Use `Navigator.pushNamed(context, '/path', arguments: data)`.
  - For `onGenerateRoute`: Extract arguments using `settings.arguments`.
- **Returning Data**: `final result = await Navigator.push(...)` and `Navigator.pop(context, data)`.
- **Replacing Screens**: Use `pushReplacement` or `pushAndRemoveUntil` for auth/splash flows.

## Code Example

```dart
// Basic Push
Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => const DetailScreen()),
);

// Named Routes Configuration
MaterialApp(
  initialRoute: '/',
  onGenerateRoute: (settings) {
    if (settings.name == '/details') {
      final args = settings.arguments as Map;
      return MaterialPageRoute(
        builder: (context) => DetailScreen(id: args['id']),
      );
    }
    return null;
  },
);

// Navigation with Arguments
Navigator.pushNamed(
  context,
  '/details',
  arguments: {'id': 123},
);
```

## Anti-Patterns

- **Deep Nesting**: Avoid anonymous routes for complex apps; use `onGenerateRoute`.
- **Manual String Paths**: Always use constants for route names.
- **Context Leaks**: Ensure `BuildContext` is valid when calling `Navigator.of(context)`. Use `ScaffoldMessenger` or global keys if navigation is needed outside `build`.

## Reference & Examples

For centralized `onGenerateRoute` implementation:
See [references/on-generate-route.md](references/on-generate-route.md).

## Related Topics

idiomatic-flutter | widgets

Files in this skill

  • SKILL.md2.1 KB
  • references/on-generate-route.md1.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.