flutter auto route generator error : [dynamic] is not a class

Viewed 2387

when I am trying to generate the routes for my app using flutter pub run build_runner build

I'm getting an error and the generated class can't be generated I only see [dynamic] is not a class in the generated class

2 Answers

try to clean and rebuild it ,It worked for me.

flutter packages pub run build_runner clean

then

flutter packages pub run build_runner build

According to the documentation:

Make sure you always Save your files before running the generator, if that doesn't work you can always try to clean and rebuild.

Then:

flutter packages pub run build_runner clean
Related