JsonObject class abstract
A JSON value.
This class is suitable for use in built_value fields. When serialized it maps directly onto JSON values.
Deep operator== and hashCode are provided, meaning the contents of a List or Map is used for equality and hashing.
List and Map classes are wrapped in UnmodifiableListView and UnmodifiableMapView so they won't be modifiable via this object. You must ensure that no updates are made via the original reference, as a copy is not made.
Note: this is an experimental feature. API may change without a major version increase.
Constructors
- JsonObject(Object? value)
-
Instantiates with
value
, which must be a bool, a List, a Map, a num or a String. Otherwise, an ArgumentError is thrown.factory
Properties
- asBool → bool
-
The value as a bool, or throw if not.
no setter
- asList → List
-
The value as a List, or throw if not.
no setter
- asMap → Map
-
The value as a Map, or throw if not.
no setter
- asNum → num
-
The value as a num, or throw if not.
no setter
- asString → String
-
The value as a String, or throw if not.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isBool → bool
-
Whether the value is a bool.
no setter
- isList → bool
-
Whether the value is a List.
no setter
- isMap → bool
-
Whether the value is a Map.
no setter
- isNum → bool
-
Whether the value is a num.
no setter
- isString → bool
-
Whether the value is a String.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → Object
-
The value, which may be a bool, a List, a Map, a num or a String.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited