JsonUtil class
JSON工具类 提供一些常用的JSON操作方法
Constructors
- JsonUtil()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
localJsonToModel<
T> (String assetPath, T fromJson(Map< String, dynamic> ), {bool fromSandbox = false}) → Future<T?> - 通用的 JSON 解析为对象的方法。
-
localJsonToModels<
T> (String assetPath, T fromJson(Map< String, dynamic> ), {bool fromSandbox = false}) → Future<List< T> > - 通用的 JSON 数组解析为对象 List 的方法。
-
readJsonFromFile(
String filePath) → Map< String, dynamic> ? - 从文件中读取 JSON 数据并解析为 Map
-
writeJsonToFile(
Map< String, dynamic> json, String filePath) → bool - 写入 JSON 数据到文件