1

I am trying to include web3.js into my Dart project. I am trying to do this via requirejs

I've created a requirejs config, which appears to load a valid web3 instance except, now my dart code never initializes! It appears that the requirejs main.js prevents my main.dart from executing. Could really use advice on how to get everything playing nicely.

main.js

requirejs.config({
appDir: ".",
baseUrl: "scripts",
paths: {'web3': 'https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min'}
});

require(['web3'], function(web3) {
    console.log("Loaded :)");
    if (typeof web3 !== 'undefined') {
        web3 = new Web3(web3.currentProvider);
    } else {
        // set the provider you want from Web3.providers
        web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

    }
    console.log(web3);
    return web3;
});

The function does get called and is passed an initialized web3 object.. except strong text

Simon Rubin
  • 198
  • 11
  • did you find a way to solve this? maybe this answer can help: https://stackoverflow.com/questions/55113108/is-it-possible-to-lazily-use-js-libs-with-dart/55192098#55192098 – Jonathan Mar 16 '19 at 00:00

0 Answers0