Flutter Beamer navigation back

1.6k Views Asked by At

I used Beamer package for navigation in our flutter project. Once navigating to page1/2/3 pages and if again called beamToNamed('/page1'), then only url is changing but screen is not changing. Screen shots attached(Logo removed in app bar) So any solution? enter image description here After changing URL through side menu enter image description here

1

There are 1 best solutions below

0
Anket Waswani On

If anyone is dealing with this, I had a similar issue. Basically how I resolved it was by giving each route a unique ValueKey

 '/products/:product': (context, state, data) {
          final product = state.pathParameters['product']!;
          return BeamPage(
            key: ValueKey('Product-$product-${DateTime.now()}'),
            title: 'A Product - $product',
            popToNamed: '/product3',
            type: BeamPageType.scaleTransition,
            child: Product(
              title: product,
            ),
          );
        },

The key: ValueKey('Product-$product-${DateTime.now()}') is what resolved the issue of navigating to and fro for me