JsonUtils class

Constructors

JsonUtils.new()
factory

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

encodeList(List? list) String?
encodeObj(dynamic value) String?
将任意对象转为 JSON 字符串
encodeObject<T>(T? obj, Map<String, dynamic> toJson(T)) String?
将单个对象转为 JSON 字符串
encodeObjectList<T>(List<T>? list, Map<String, dynamic> toJson(T)) String?
fromJson<T>(String? jsonStr, T fromMap(Map<String, dynamic> map)) → T?
JSON 字符串转为对象
listFromJson<T>(dynamic source, T fromMap(Map<String, dynamic> map)) List<T>?
JSON 字符串或列表转为对象列表
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printJson(dynamic obj, {bool prettyPrint = true}) → void
打印 JSON 字符串(支持缩进)
toMap(String? jsonStr) Map<String, dynamic>?
JSON 字符串转为 Map
toMapList(String? jsonStr) List<Map<String, dynamic>>?
JSON 字符串转为 List
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited