我有这个:
List<String> _filters = <String>[8, 11];
我将其传递_filters
到此端点:
this.api.setInterests(token, _filters)
.then((res) {
print(res);
});
Run Code Online (Sandbox Code Playgroud)
看起来像这样:
Future setInterests(String token, List<String> interests) {
return _netUtil.post(BASE_URL + "/setinterests", body: {
"token": token,
"interests": interests
}).then((dynamic res) {
return res;
});
}
Run Code Online (Sandbox Code Playgroud)
传递_filters
总是抛出错误:
type 'List<String>' is not a subtype of type 'String' in type cast
我不知道 dart 还想从我这里得到什么。
我找到了答案。我刚刚添加.toString()
到列表中_filters
。
this.api.setInterests(token, _filters.toString())
.then((res) {
print(res);
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8009 次 |
最近记录: |