【问题标题】:i am trying to make a get request but i keep getting this issue我正在尝试提出获取请求,但我不断收到此问题
【发布时间】: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


    【解决方案1】:

    尝试以下步骤:

    1. 扑干净
    2. 从 C:/flutter/.pub-cache/hosted/pub.dartlang.org 中删除 http-0.13.3 打包程序
    3. 运行 pub 获取 然后尝试再次运行您的应用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-23
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      • 1970-01-01
      • 2020-01-21
      • 2022-06-26
      • 1970-01-01
      相关资源
      最近更新 更多