连接到以太坊节点时出错
E/扑动(23790):[错误:flutter/lib/ui/ui_dart_state.cc(148)]未处理的异常:套接字异常:连接失败(操作系统错误:网络无法访问,错误号= 101)
------------------------------web 3连接代码如下-----------------------------------------------------------
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart';
import 'dart:async';
const String rpcUrls = 'https://node1.bitcoiin.com';
class HomeScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _HomeScreenState();
}
}
class _HomeScreenState extends State<HomeScreen> {
@override
void initState() {
main();
super.initState();
}
main(){
var ethClient = new Web3Client(apiUrls, new Client());
print(ethClient.getBlockNumber());
}
1条答案
按热度按时间htzpubme1#
我仍然不知道为什么这个解决方案的作品,但我有同样的问题,我试图取代
localhost
的IP地址到我的服务器(e.g.192.168.1.33
).请为您的应用尝试以下代码: