Error when running flutter pub run build_runner build --delete-conflicting-outputs

1k Views Asked by At

I'm trying to integrate a smart contract into my flutter and I'm referring to this example. I have included all the dependencies and dev_dependencies in the first step and I'm stuck in the second step where this error occurs where the system could not find the path to builders.dart in the web3dart package. error pic

2

There are 2 best solutions below

2
Mobin Ansar On

After updating Flutter to version 2.5.2, there were some conflicts even though no code was changed, therefore I use any in pubspec.yaml.

 dependencies:
      flutter:
        sdk: flutter
      moor: ^4.5.0
      provider: ^5.0.0
      path_provider: any
      path: ^1.8.0
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
      moor_generator: any
      build_runner: any
      flutter_launcher_icons: any
0
Jason Devillier On

For me, I had to downgrade to web3dart: ^2.3.5 from ^2.4.1 (pubspec.yaml)

Ran flutter pub get

But the web3dart-2.4.1 folder remained in .../flutter/.pub-cache/hosted/pub.dartlang.org/

The problem was that build_runner was still looking in the 2.4.1 folder

So I removed everything from the .../flutter/.pub-cache/hosted/pub.dartlang.org/web3dart-2.4.1 folder and moved everything from the .../flutter/.pub-cache/hosted/pub.dartlang.org/web3dart-2.3.5 folder into the .../flutter/.pub-cache/hosted/pub.dartlang.org/web3dart-2.4.1 folder

Closed Android Studio

Reopened it and ran flutter pub run build_runner build

And it worked

CAUTION: DO NOT RUN FLUTTER PUB UPDATE BEFORE RUNNING FLUTTER PUB RUN BUILD_RUNNER BUILD

When I ran flutter pub update, it pulled a completed different web3dart version (2.4.0) into .../pub.dartlang.org/, which has the same bug in it.

Your folder version may be different, but if you can get the web3dart-2.3.5 version and find which folder build_runner is looking in (by running it in Terminal and reading the error message), you can put the good code into there and it should work