y-pakorn / flutter_web3

Web3 Ethereum, Etherjs and Wallet Connect wrapper for Flutter Web.
Other
136 stars 46 forks source link

Cannot use the library - js related error when building #47

Closed 0xStef closed 2 years ago

0xStef commented 2 years ago

Describe the bug I cannot use the library flutter_web3. Get JS related errors when building.

I could not find a fix online.

To Reproduce Steps to reproduce the behavior:

  1. Install the library flutter_web3
  2. Then run: flutter run
  3. Build fails... See logs below

Build logs

../../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_web3-2.1.9/lib/src/ethereum/ethereum.dart:66:7: Error: Method not found: 'hasProperty'.
      hasProperty(_window, 'ethereum') || hasProperty(_window, 'BinanceChain');
      ^^^^^^^^^^^
../../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_web3-2.1.9/lib/src/ethereum/ethereum.dart:66:43: Error: Method not found: 'hasProperty'.
      hasProperty(_window, 'ethereum') || hasProperty(_window, 'BinanceChain');
                                          ^^^^^^^^^^^
../../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_web3-2.1.9/lib/src/ethereum/ethereum.dart:147:50: Error: The method 'callMethod' isn't defined for the class 'Ethereum'.
 - 'Ethereum' is from 'package:flutter_web3/src/ethereum/ethereum.dart' ('../../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_web3-2.1.9/lib/src/ethereum/ethereum.dart').
Try correcting the name to the name of an existing method, or defining a method named 'callMethod'.
  off(String eventName, [Function? listener]) => callMethod(impl, 'off',
                                                 ^^^^^^^^^^
../../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_web3-2.1.9/lib/src/ethereum/ethereum.dart:148:38: Error: The method 'allowInterop' isn't defined for the class 'Ethereum'.

Thanks, Stef

0xStef commented 2 years ago

Oh never mind, it only supports web. :/