Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个结构化数据文件。我创建了文件,因此格式可以灵活。目前它是一种自定义文本格式,但也可以是 xml 或 Json。我的意图是将其全部加载到客户端,然后将其放入内部存储器结构中。从服务器获取资源文件并在 Dart 中解析的正确方法是什么?
你考虑过只使用 JSON 吗?
在服务器上执行此操作:
import 'dart:json'; var obj = {'foo': 'bar'}; var output = JSON.stringify(obj); // Send the output to the client.
然后在你做的客户端上:
import 'dart:json'; var obj = JSON.parse(jsonedObject); // obj now holds a {'foo': 'bar'}
还是我理解错了问题?