You may get the error if you run riverpod code generation tools
riverpod Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
The other day, I was using Riverpod 2.0 for code generation and state management using Flutter Riverpod Task management app. But I got the above error.
There could be many reasons why it happens, one of the reason with me was version problem.
I had to specifically mention the version to make it work.
See what was causing problem

I changed the version to below one

With the above version it worked. So you should change the version and check if you have the same error.