![](/img/trans.png)
[英]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.