close

[Solved] Failed to precompile build_runner:build_runner Error on flutter pub

Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. Failed to precompile build_runner:build_runner in a flutter. So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How Failed to precompile build_runner:build_runner Error on flutter pub ?

When I run flutter pub run build_runner build I am facing this issue. I have already tried

  1. flutter clean
  2. flutter pub-cache repair
  3. flutter pub get

build_runner are added on pubspec and flutter pub get ran successfully as well.

How to Solve Failed to precompile build_runner:build_runner Error on flutter pub ?

Question: How to Solve Failed to precompile build_runner:build_runner Error on flutter pub ?
Answer: To solve this error The problem is in the analyzer plugin. When I add the analyzer dependency 1.5.0 in the dev-dependencies of pubspec.yaml worked for me. Just open your pubspec.yaml file. in the dev_dependencies just add analyzer dependency 1.5.0. Same as below.

Solution 1

The problem is in the analyzer plugin. When I add the analyser dependency 1.5.0 in the dev-dependencies of pubspec.yaml worked for me.

  1. Just open your pubspec.yaml file.
  2. in the dev_dependencies just add analyzer dependency 1.5.0.
  3. Same as below.

Solution 2

Another solution is Changing the analyzer version in pubspec.lock file to 1.5.0 seems to fix the issue.

Before

After

Then Just Run flutter clean and flutter pub get.

Solution 3

I Think analyzer Plugins latest version seems to be an issue. just downgrade analyzer by version from 1.6.0 to 1.5.0.

Summery

So, It’s All About Failed to precompile build_runner:build_runner Error on flutter pub. I hope this tutorial helps you to solve your error. Please Comment Below if You stucks anywhere with my code.

Also Check Out Below Tutorials

Leave a Comment

%d bloggers like this: