How to Solve Pub Run build_runner build Failed In Flutter ?

· 2 min read
How to Solve Pub Run build_runner build Failed In Flutter
How to Solve Pub Run build_runner build Failed In Flutter

When the user creates a flutter project and runs a flutter command flutter pub get sometimes he may get an error that says “How to Solve Pub Run build_runner build Failed In Flutter ?”

How to Solve Pub Run build_runner build Failed In Flutter?

To Solve this error user can give try to below method:

flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs

add a dependency in pubsec.yaml, analyzer: ‘0.39.14‘. Add Dependencies like the below:

flutter clean
flutter pub cache repair
flutter pub run build_runner clean

Then run,

flutter pub run build_runner build

Users can give try to below method.

Successfully generating all *.g.dart files with:

build_runner 0.9.2
json_serializable 0.5.8+1
json_annotation 0.2.9+1

It seems to break build_runner or json_serializable in version:

Analyzer: 0.39.16

Going back to the dart analyzer version:

Analyzer: 0.39.14

This error is basically caused by the auto formatter removing the line like below.

part 'my_class.g.dart';

Conclusion:

In this article, We have a walkthrough How to Solve Pub Run build_runner build Failed In Flutter?

Thanks for Reading !!!

Keep Learning !!! Keep Fluttering !!!

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Leave a Reply