Skip to content
Back to skills

Flutter Auto Route Navigation

ASecurity

With `auto_route`, you pass route parameters by defining them on the page constructor and then navigating with the generated typed route class. First, annotate the page and give it an `orderId` parameter: ```dart import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; @RoutePage() class OrderDetailPage extends StatelessWidget { const OrderDetailPage({ super.key, required this.orderId, }); final String orderId; @override Widget build(BuildContext context) { return ...

  • 584 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
developmentapi

Works with

  • api

Security analysis

A100/100

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

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill flutter-auto-route-navigation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flutter Auto Route Navigation?

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

Security grade badge for Flutter Auto Route Navigation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-flutter-auto-route-navigation-93d021df/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-flutter-auto-route-navigation-93d021df)

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
With `auto_route`, you pass route parameters by defining them on the page constructor and then navigating with the generated typed route class.

First, annotate the page and give it an `orderId` parameter:

```dart
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';

@RoutePage()
class OrderDetailPage extends StatelessWidget {
  const OrderDetailPage({
    super.key,
    required this.orderId,
  });

  final String orderId;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Order Detail')),
      body: Center(
        child: Text('Showing order: $orderId'),
      ),
    );
  }
}
```

Add the route to your router:

```dart
@AutoRouterConfig()
class AppRouter extends _$AppRouter {
  @override
  List<AutoRoute> get routes => [
    AutoRoute(page: HomeRoute.page, initial: true),
    AutoRoute(page: OrderDetailRoute.page),
  ];
}
```

After code generation, navigate with the generated route class:

```dart
context.pushRoute(
  OrderDetailRoute(orderId: 'ORD-12345'),
);
```

You can also replace instead of push if that better matches the flow:

```dart
context.replaceRoute(
  OrderDetailRoute(orderId: 'ORD-12345'),
);
```

This is preferred because:

- the route is typed,
- the parameter is validated by the constructor,
- there are no hard-coded string route names,
- refactors stay safe because generated APIs change with the page definition.

So the short answer is: define `final String orderId` on `OrderDetailPage`, annotate the page with `@RoutePage()`, register `OrderDetailRoute.page`, then call `context.pushRoute(OrderDetailRoute(orderId: ...))`.

Files in this skill

  • eval-1.baseline.md1.5 KB
  • eval-1.with-skill.md2 KB
  • eval-2.baseline.md1.5 KB
  • eval-2.with-skill.md1.6 KB
  • eval-3.baseline.md2.2 KB
  • eval-3.with-skill.md2.8 KB
  • trigger-1.md144 B
  • trigger-2.md174 B
  • trigger-3.md158 B
  • trigger-4.md163 B
  • trigger-5.md182 B

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 development →

Comments

Loading comments…

Newsletter

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