具体报错如下:
flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type 'int' is not a subtype of type 'Iterable<dynamic>'
原因是我使用了get请求并且参数并不是拼接在url后面,也就是这种形式,xxx?x=1&y=2。
而是使用 Map<String, dynamic>? query一个map去放置参数.。
查看源码找到原因,如果query中的值不是string 类型就会被转换为一个迭代器,而我放置是个int,所以转换报错,解决办法是吧query这个map中的所有的值转换成string处理。
query?.map((key, value) => MapEntry(key, value.toString()))