I try to connect a contract in web3 with flutter and run a method inside that. Our react-js developer give me these codes to connect to the getMoney method:
const web3 = new Web3(Web3.givenProvider ||"https://rinkeby.infura.io/v3/...");
const contactList = new web3.eth.Contract(CONTACT_ABI, CONTACT_ADDRESS);
const getMoney = await contactList.methods.getMoney().call();
console.log(getMoney);
I try to use flutter_web3 package to connect to metamask and contract:
String abi = await rootBundle.loadString("assets/json/Counter.json");
final contract = Contract(CONTACT_ADDRESS, abi, Web3Provider("https://rinkeby.infura.io/v3/..."),);
int money = await contract.call("getMoney");
print(money.toString());
But I can't connect to contract and call getMoney method. Can you help me?