JSON class

JSON解析器

Available Extensions

Constructors

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

Properties

hashCode int
The hash code for this object.
no setterinherited
rawValue → dynamic
解析的值
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

as<T>() → T?
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
unwrap<S>() Unwrap<S>

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 关联的值