[go_router] Missing exit animation support

This issue has been tracked since 2023-03-18.

With the normal Navigator, you can provide a custom Route object when you run Navigator.push in order to provide custom animations.

  static Future<T?> push<T extends Object?>(BuildContext context, Route<T> route) {
    return Navigator.of(context).push(route);

The reason this is important is because it allows you to specify an exit transition of the underlying page that is being moved away from.

Here is a thread explaining the desired effect.

With GoRouter, this feature is partially missing.

          path: '/home',
          pageBuilder: (context, state) {
            return CustomTransitionPage(
              key: state.pageKey,
              child: const Home(),
              opaque: false,
                  (context, animation, secondaryAnimation, child) {
                return defaultPageTransition(
                  reverse: true,


There is currently no support go function that can consume an optional Route to handle exit transitions.

The CustomTransitionPage even provides the secondaryAnimation, mimicing the Navigator's exact behavior. It's simply unused.

I propose an exitTransitionBuilder in the constructor of CustomTransitionPage or support for a custom Route as an optional parameter in GoRouter.of(context).go('/', ....)

This is a very important missing feature from this package. I am currently unable to create fancier transition animations, and packages Flutter's own animations package https://pub.dev/packages/animations which heavily utilizes exit animations can not replicate their transitions with GoRouter.

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2023-03-30
Star Count 151602
Watcher Count 3555
Fork Count 25000
Issue Count 11498


Issue Title Created Date Updated Date