'EpisodeDetailsRouteArgs can not be null because it has a required parameter

I got EpisodeDetailsRouteArgs can not be null because it has a required parameter this error, even I passed the arguments.

Here my inkwell widget:

   onTap: () {
              AutoRouter.of(context).replace(EpisodeDetailsRoute(
                podcastImageUrl: podcastImageUrl,
                podcastName: podcastName,
                podcastOwner: podcastOwner,
                podcastEpisodes: podcastEpisodes,
              ));
            },

my router:

@MaterialAutoRouter(
  replaceInRouteName: 'Page,Route',
  routes: <AutoRoute>[
    AutoRoute(page: IntroductionPage),
    AutoRoute(
      page: LoginPage,
    ),
    AutoRoute(page: HomePage),
    AutoRoute(page: EpisodeDetailsPage, initial: true),
  ],
)
class $AppRouter {}

my EpisodeDetailsPage:

class EpisodeDetailsPage extends StatelessWidget {
  const EpisodeDetailsPage({
    Key? key,
    required this.podcastImageUrl,
    required this.podcastName,
    required this.podcastOwner,
    required this.podcastEpisodes,
  }) : super(key: key);

  final String podcastImageUrl;
  final String podcastName;
  final String podcastOwner;
  final String podcastEpisodes;
  @override
  Widget build(BuildContext context) {
    return const Scaffold();
  }
}

I use the latest version of auto_route. Can you help me ?



Solution 1:[1]

I just changed the initial route which is EpisodeDetailsPage. If you get this error, you should change the initial route.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 efesahin