[英]Unhandled Exception: Converting object to an encodable object failed: Instance of 'XFile'
[英]I get the error 'Unhandled Exception: Converting object to an encodable object failed: Null' in flutter
我正在尝试将 JSON 发布到我们的 api,但即使所有值都是 NULL 并且允许为 NULL,也会继续收到此错误,这是导致问题的代码片段。
final response = await http.post(Uri.parse('http://"api"/api/createPin'),
body: json.encode({
'location': Null,
'description': Null,
'qrcode': Null,
'ttl': Null,
'tier': Null,
'type': Null,
'user': Null,
'images': Null,
'viewable_users': Null
}),
);
我搜索了论坛和一些视频,但都没有解决我的问题,我不知道我做错了什么。
从Null
更改为null
怎么样?
您正在寻找“空”而不是“空”。
Null 是一个无法实例化的 class 和 null 一个值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.