LDValue class final

An immutable instance of any data type that is allowed in JSON.

LDValue provides the type of the contained value as an LDValueType returned by type.

Properties

hashCode int
The hash code for this object.
no setteroverride
keys Iterable<String>
Enumerates the property names in an object, returns an empty iterable for all other types.
no setter
length int
Returns the number of elements in an array or object, returns 0 for all other types.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type LDValueType
Get the type of this value.
no setter
values Iterable<LDValue>
Enumerates the property values in an array or object, returns an empty iterable for all other types.
no setter

Methods

booleanValue() bool
Returns this value as a bool if the type matches, otherwise returns false.
doubleValue() double
Returns this value as a double if the value is numeric, otherwise returns 0.
get(int index) LDValue
Retrieves an array element by index.
getFor(String key) LDValue
Retrieves an object element by index.
intValue() int
Returns this value as an int if the value is numeric, otherwise returns 0.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stringValue() String
Returns this value as a String if the type matches, otherwise returns an empty string.
toDynamic() → dynamic
Convert this LDValue into a dynamic.
toString() String
A string representation of this object.
override

Operators

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

Static Methods

buildArray() LDValueArrayBuilder
Starts building an array value.
buildObject() LDValueObjectBuilder
Starts building an object value.
ofBool(bool value) LDValue
Returns an instance for a bool value.
ofDynamic(dynamic json) LDValue
Given a dynamic produce an LDValue.
ofNull() LDValue
Returns an instance for a null value.
ofNum(num value) LDValue
Returns an instance for a numeric value.
ofString(String value) LDValue
Returns an instance for a string value.