Hello i have a problem with go_router. When I do a context.push to a other router declared in Router, it pass from initialLocation.
My initial location is "/home" the other route where i am going is "/new-product".
Why happen that?
onPressed: () {
context.push(RoutingPath.uploadProduct);
},
class TwRouter extends GoRouter {
TwRouter(
final AuthenticationService auth,
final TokenService tokenService,
final NavigationService navigationService,
) : super(
debugLogDiagnostics: true,
redirect: (state) {
...
return null;
},
routes: [
GoRoute(
path: RoutingPath.home,
builder: (context, state) => TwDefaultLayout(
authenticationService: auth,
tokenService: tokenService,
initialPage: navigationService.currentPage,
pageList: [
HomePage(reload: state.extra as bool?),
],
listIcons: const [
"assets/images/icons/bottom_bar/home.svg",
]),
),
GoRoute(
path: RoutingPath.uploadProduct,
builder: (context, state) => UploadProduct(
authenticationService: auth,
tokenService: tokenService,
),
),
],
refreshListenable: GoRouterRefreshStream(auth.authStateChanges.stream
..forEach((element) => debugPrint(element.toString()))),
initialLocation: RoutingPath.home,
);
}