颤振无法从api获得响应

时间:2021-02-09 13:23:11

标签: flutter dart flutter-layout flutter-dependencies dart-pub

大家好,我正在尝试从服务器 api 获取数据,同样在邮递员中工作得很好,但是当我从 flutter 中点击时,我得到以下异常

I/flutter (20104):

Object Moved

可以找到此文档here

这是我的代码

 var bodyMap = json.encode(map);

    final response = await client.post(
      "$baseUrl/api/Course/List",
      headers: {"content-type": "application/json"},
      body: bodyMap,
    );

    print("##courses coming"+response.toString());

    if (response.statusCode == 201) {
      print("##coming to 201");
      return responseFromJson(response.body);
    }else if(response.statusCode == 400)
    {
      print("##coming to 400---"+response.statusCode.toString());
      print("##coming to 400-body-"+responseFromJson(response.body).toString());
      return responseFromJson(response.body);
    }
    else {
      print("##coming to 200---"+response.body.toString());
      var s=responseFromJson(response.body);
      print("##coming to success-"+s.toString());
      return responseFromJson(response.body);
    }

0 个答案:

没有答案