【发布时间】:2021-11-03 21:51:29
【问题描述】:
void getData() async {
try {
final response = await get(
Uri.parse("https://jsonplaceholder.typicode.com/todos/1"),
);
final data = jsonDecode(response.body);
print(data);
} catch (err) {
print('page failed to load');
}
}
void initState() {
super.initState();
getData();
}
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.3/lib/src/io_client.dart:30:32:错误:在此之前应为 ')'。 var ioRequest = (Coawait _inner!.openUrl(request.method, request.url)) ^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.3/lib/src/io_client.dart:30:24: 错误:没有为类 'IOClient' 定义 getter 'Coawait'。
- 'IOClient' is from 'package:http/src/io_client.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.3/lib/src/io_client.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'Coawait'. var ioRequest = (Coawait _inner!.openUrl(request.method, request.url))
【问题讨论】:
标签: flutter dart asynchronous