转换dart http.get请求以匹配构造函数

时间:2019-02-26 05:00:07

标签: dart flutter

我在dart中有以下代码:

final uri = Uri.https('api.server', '/json/pages', queryParams);
final response =
    await http.get(uri, headers: {"Accept": "application/json"});

但是该应用抛出异常的原因是:

type '_InternalLinkedHashMap<String, Object>' is not a subtype of type 'Map<String, String>'

如何将响应转换为http.get的构造函数期望的有效类型,或者还有其他解决方法?

谢谢

1 个答案:

答案 0 :(得分:1)

您可能需要修复queryParams

inline-block

Look at here