While working with GoRouter in Flutter, I was trying to debugPrint the page keys to see the checkout routing.
I’m expecting a result of readable strings such as “/cart/checkout-p1” or something, but as shown in the image, it resulted in “yeoapcyyctcqnctjsi[hgeYgyidi
^” instead.
I did not do anything complicated.
Inside my GoRouter class
return GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
name: AppRoute.home.name,
builder: (context, state) => const ProductsScreen(),
routes: [
GoRoute(
path: 'cart',
name: AppRoute.cart.name, //this is just an enum value
pageBuilder: (context, state) => const MaterialPage(
fullscreenDialog: true,
child: ShoppingCartScreen(),
),
routes: [
GoRoute(
path: 'checkout',
name: AppRoute.checkout.name,
pageBuilder: (context, state) {
//Unreadable pageKey.value string here
debugPrint(state.pageKey.value);
return const MaterialPage(
fullscreenDialog: true,
child: CheckoutScreen(),
);
}),
],
),
//and the rest of the other routing code goes here
Simple as it is.
Could someone kindly point me in the right direction as to why this happened?
Screenshot of the problem:
If it helps, I’m using go_router: 12.1.1
I’m expecting a result of readable strings such as “/cart/checkout-p1” or something, but as shown in the image, it resulted in “yeoapcyyctcqnctjsi[hgeYgyidi
^” instead.