LDValue class Null safety
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 getType.
Properties
- hashCode → int
-
The hash code for this object.
read-onlyoverride
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
booleanValue(
) → bool -
Returns this value as a
bool
if the type matches, otherwise returnsfalse
. -
codecValue(
) → dynamic - Returns a raw platform representation of the value.
-
doubleValue(
) → double -
Returns this value as a
double
if the value is numeric, otherwise returns0
. -
get(
int index) → LDValue - Retrieves an array element by index.
-
getFor(
String key) → LDValue - Retrieves an object element by index.
-
getType(
) → LDValueType - Returns the type of this value.
-
intValue(
) → int -
Returns this value as an
int
if the value is numeric, otherwise returns0
. -
keys(
) → Iterable< String> - Enumerates the property names in an object, returns an empty iterable for all other types.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
numValue(
) → num -
Returns this value as a
num
if the value is numeric, otherwise returns0
. -
size(
) → int -
Returns the number of elements in an array or object, returns
0
for all other types. -
stringValue(
) → String -
Returns this value as a
String
if the type matches, otherwise returns an empty string. -
toString(
) → String -
A string representation of this object.
inherited
-
values(
) → Iterable< LDValue> - Enumerates the property values in an array or object, returns an empty iterable for all other types.
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.
-
fromCodecValue(
dynamic value) → LDValue - Constructs a value from an arbitrary platform value.
-
normalize(
LDValue? value) → LDValue - Returns the same value if non-null, or ofNull if null.
-
ofBool(
bool? value) → LDValue - Returns an instance for a bool value.
-
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.