JSON class

JSON解析器

Available extensions

Constructors

JSON([dynamic _rawValue = const {}, JSONKey? _key])
创建一个新的JSON解析器 rawValue 解析的值 默认为空字典 key 关联上一个JSON的数据 用于在设置值的时候更新最顶层的JSON

Properties

bool → JSONBool?

Available on JSON, provided by the JSONToBool extension

转换为一个可能为空的bool类型
no setter
boolValue → JSONBool

Available on JSON, provided by the JSONToBool extension

转换为一个默认为为false 不为空的bool类型
no setter
double → JSONDouble?

Available on JSON, provided by the JSONToDouble extension

转换为一个可能为空的double类型
no setter
doubleValue → JSONDouble

Available on JSON, provided by the JSONToDouble extension

转换为一个默认为为0 不为空的double类型
no setter
hashCode int
The hash code for this object.
no setterinherited
int → JSONInt?

Available on JSON, provided by the JSONToInt extension

转换为一个可能为空的int类型
no setter
intValue → JSONInt

Available on JSON, provided by the JSONToInt extension

转换为一个默认为为0 不为空的int类型
no setter
isBool → JSONBool

Available on JSON, provided by the JSONToBool extension

no setter
isDouble bool

Available on JSON, provided by the JSONToDouble extension

no setter
isInt bool

Available on JSON, provided by the JSONToInt extension

no setter
isList bool

Available on JSON, provided by the JSONToArray extension

no setter
isMap bool

Available on JSON, provided by the JSONToMap extension

no setter
isNum bool

Available on JSON, provided by the JSONToNumber extension

no setter
isString bool

Available on JSON, provided by the JSONToString extension

no setter
list → JSONArray?

Available on JSON, provided by the JSONToArray extension

转换为一个可能为空的Array类型
no setter
listValue → JSONArray

Available on JSON, provided by the JSONToArray extension

转换为一个默认为为空的Array类型
no setter
map → JSONObject?

Available on JSON, provided by the JSONToMap extension

转换为一个可能为空的Map类型
no setter
mapValue → JSONObject

Available on JSON, provided by the JSONToMap extension

转换为一个默认为为空的Map类型
no setter
num → JSONNum?

Available on JSON, provided by the JSONToNumber extension

转换为一个可能为空的Number类型
no setter
numValue → JSONNum

Available on JSON, provided by the JSONToNumber extension

转换为一个默认为为0 不为空的Number类型
no setter
rawValue → dynamic
解析的值
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
string → JSONString?

Available on JSON, provided by the JSONToString extension

转换为一个可能为空的String类型
no setter
stringValue → JSONString

Available on JSON, provided by the JSONToString extension

转换为一个默认为为空的String类型
no setter

Methods

exists() bool
检测对应Key 的值是否存在
forEachList(void callback(int, JSON)) → void
循环读取List中的所有值
forEachMap(void callback(String, JSON)) → void
循环读取Map中的所有值
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
tryFromArray(dynamic key) JSON?

Available on JSON, provided by the JSONGetOperations extension

tryFromKeyPath(dynamic key) JSON?

Available on JSON, provided by the JSONGetOperations extension

tryFromObject(dynamic key) JSON?

Available on JSON, provided by the JSONGetOperations extension

trySetArray(dynamic key, dynamic value) → void

Available on JSON, provided by the JSONSetOperations extension

trySetKeyPath(dynamic key, dynamic value) → void

Available on JSON, provided by the JSONSetOperations extension

trySetObject(dynamic key, dynamic value) → void

Available on JSON, provided by the JSONSetOperations extension

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](dynamic key) JSON
通过key 获取下一个JSON 不存在则返回空的JSON
operator []=(dynamic key, dynamic value) → void
根据key 更新value key 关联的键 value 关联的值