2

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

Leo
  • 179
  • 9

2 Answers2

0

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
Mobin Ansar
  • 631
  • 2
  • 13
  • Still the same. I think my main problem is **System could not find the path to builders.dart in the web3dart package.** – Leo Sep 21 '22 at 04:49
  • May be https://flutteragency.com/how-to-solve-pub-run-build_runner-build-failed-in-flutter/ follow this – Mobin Ansar Sep 21 '22 at 04:58
0

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