flutter Auto_route package is not working on nestd route on flutter 2.5.2 i have named my routing file different from router.dart in case it is messing up with default routing settings, cant find any solution.

import 'package:auto_route/auto_route.dart';
import 'package:flutteraoutroutepackage/pages/pages.dart';

  replaceInRouteName: 'Page,Route',
  routes: <AutoRoute>[
    //HomePage route
      path: '/',
      page: HomePage,
      initial: true,
      children: [
        //books route
          path: "books",
          name: "BooksRouter",
          page: EmptyRouterPage,
          children: [
            AutoRoute(path: '', page: BooksPage),
            AutoRoute(path: ':bookId', page: BookDetailsPage),
            RedirectRoute(path: "*", redirectTo: '')
class $AppRouter {}


import 'package:flutter/material.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutteraoutroutepackage/routes/app_router.gr.dart';

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: ElevatedButton(
        child: const Text('Go to Lists'),
        onPressed: () => context.router.push(BooksRoute()),

Solution 1: rvng

AutoRouter.of(context).push(BooksRouter(children: [ BooksRoute()]) https://autoroute.vercel.app/basics/nested_routes

Solution 2: ahmed

you could use Getx package and Get.to() to solve this problem