gpt4 book ai didi

dart - Dart 中 jsonEncode() 和 json.encode() 之间的区别和首选方式是什么?

转载 作者:IT王子 更新时间:2023-10-29 06:36:24 32 4
gpt4 key购买 nike

在Flutter doc中,它使用jsonEncode(),而在Angular doc中,它使用json.encode()。两者的区别和首选方式是什么?

最佳答案

jsonEncode 作为 json 的别名被引入是因为 json 经常与变量名 json 冲突,许多用于保存 JSON 值的变量。

var json = http.get(...);
var data = json.decode(json); // error
var data = jsonDecode(json); // ok

关于dart - Dart 中 jsonEncode() 和 json.encode() 之间的区别和首选方式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54859595/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com