> For the complete documentation index, see [llms.txt](https://flutter-boilerplate.gitbook.io/flutter-boilerplate-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flutter-boilerplate.gitbook.io/flutter-boilerplate-docs/features/routing.md).

# Routing

The router functions are defined in&#x20;

```dart
class AppRouter { ... }
```

In the same file the style of the page transition is defined in

```dart
class CustomPageRoute1 extends MaterialPageRoute { ... }
```

## Adding a new route

Copy one of the existing routes in the `switch-case` structure of the  `onGenerateRoute()` function. Replace the route name in the `case`statement and the child of the `CustomPageRoute1()` with the widget you want to display under the route.

Every widget that is used as route has the route name as `static const route` parameter to avoid misspelling of the route name in the code.

## Wrapper

There are two wrapper classes

```dart
class AuthenticationWrapper extends StatefulWidget { ... }
```

and&#x20;

```dart
class UserDataWrapper extends StatefulWidget { ... }
```

Wrap a route in the `AuthenticationWrapper`if it must be checked if the user is signed in to redirect to another page. In the template this only refers to the landing page route from which the user should be navigated to the dashboard when already signed in.

Wrap a route in the UserDataWrapper when the user data must be fetched from the database and be available for this route. In the template this refers to every route which can only be seen by logged in users.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://flutter-boilerplate.gitbook.io/flutter-boilerplate-docs/features/routing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
