dart - 什么是类似 java 中的 Gson 的 flutter dart 中可用的等效库

标签 dart flutter android gson

是否有任何库可用于保存和恢复对象。
在 android java 中,我们使用 Gson 来执行此操作,但在 flutter 中没有 Gson

最佳答案

像 GSON 这样的库在 Flutter 中是不可能的,因为 Flutter 不支持代码反射。反射干扰tree shaking which flutter 需要清除未使用的代码并提供紧凑的应用程序。

more on the topic and alternatives here

您可以使用 this site to convert your JSONs类,它会自动准备 toJson fromJson 方法。

关于dart - 什么是类似 java 中的 Gson 的 flutter dart 中可用的等效库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54036514/

相关文章:

flutter - 如何迫使Container达到其 child 的高度?

flutter - Flutter 是否将 Dart 代码转换为 Java/Kotlin?

android - 如何验证 Android DevicePolicyManager#isAdminActive 与未能激活设备管理器的结果

dart - 使用 const 的分析器选项

flutter - 使用Switch语句在Flutter ListView中添加多种颜色

c++ - 如何从 dart 中异步调用用 C/C++ 编写的函数?

android - 为什么需要shrinkWrap?

android - Flutter Blue无法检测到蓝牙打印机(Zebra ez320)

android - 在 Android 中使用 XML 定义层次结构

android - Android 中 CMake 的 LOCAL_STATIC_LIBRARIES 的等价物是什么?