> 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.
