navigation

Implements type-safe Flutter routing with GoRouter, redirects, and deep linking.

162|23|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/VeryGoodOpenSource/vgv-ai-flutter-plugin --skill navigation-verygoodopensource
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: navigation
Source: https://github.com/VeryGoodOpenSource/vgv-ai-flutter-plugin/tree/main/skills/navigation
Command: npx skills add https://github.com/VeryGoodOpenSource/vgv-ai-flutter-plugin --skill navigation-verygoodopensource

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Flutter navigation code often relies on raw string paths, untyped parameters, and inconsistent go/push usage, which breaks deep linking, web support, and back-button behavior. This Skill enforces GoRouter best practices so routes are type-safe, hierarchical, and testable. ## Core Features & Use Cases - Type-Safe Routes: Define routes with @TypedGoRoute annotations and GoRouteData classes, generating helpers via go_router_builder instead of raw string paths. - Redirects & Guards: Implement root-level authentication redirects and route-level authorization guards with correct parent-before-child execution order. - Parameter Strategies: Use path parameters for resource identification and query parameters for filtering, avoiding the prohibited extra parameter that breaks deep linking. - Use Case: When adding a product detail screen, define a GoRouteData subclass with a path parameter like article/:id, nest it under the parent route, regenerate helpers with build_runner, and navigate using the generated type-safe class. ## Quick Start Ask the assistant to add a new type-safe GoRouter route for a details page with an id path parameter and wire up navigation from the list screen.

Frequently Asked Questions about navigation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create type-safe routes in Flutter with GoRouter?

Define a class extending GoRouteData annotated with @TypedGoRoute, specifying a name and path. Run dart run build_runner build to generate type-safe helpers, then navigate using the generated route class instead of raw string paths.

When should I use go() vs push() in GoRouter?

Use go() for standard navigation between screens since it updates the URL and enables app bar back buttons. Use push() only when the destination must return data to the caller, such as a dialog collecting user input.

Why is the extra parameter discouraged in GoRouter?

The extra parameter does not work on the web and cannot be used for deep linking. Instead, pass identifiers via path or query parameters and fetch the required data within the destination page.

How do I test widgets that use GoRouter navigation?

Create a MockGoRouter with package:mocktail and wrap the widget under test in InheritedGoRouter. Then verify navigation calls such as goNamed using mocktail's verify after simulating user taps.

How do redirects work for authentication in GoRouter?

Add a redirect callback at the root GoRouter level that checks authentication state and returns the sign-in route location when unauthenticated. Route-level redirects handle authorization, and parent redirects always execute before child redirects.