DataArray class abstract
A data array with property values accessed by int
keys (or indexes).
See samples below to create a copied data array, a view wrapping an
instance of the standard Iterable
, and decoding one from JSON.
final copied = DataArray.of(['foo', 'bar', 2, null]);
final list = ['foo', 'bar', 2, null];
final view = DataArray.view(list);
final json = DataArray.decodeJson('["foo", "bar", 2, null]');
- Inheritance
-
- Object
- PrimitiveAccessor<
int> - ValueAccessor<
int> - DataElement<
int> - DataArray
- Implementers
Constructors
- DataArray.new()
-
Default
const
constructor to allow extending this abstract class.const - DataArray.decodeJson(String source)
-
Creates a data array from
source
containing an encoded JSON Array.factory - DataArray.empty()
-
Creates an empty data array.
factory
-
DataArray.of([Iterable<
Object?> source = const <Object>[]]) -
Creates a data array with items copied from
source
.factory -
DataArray.view(Iterable<
Object?> source) -
Creates a data array view backed by
source
.factory
Properties
-
arrays
→ Iterable<
DataArray> -
Returns an iterable for childs that can be represented as DataArray.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Returns true if the collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Returns true if the collection has at least one element.
no setterinherited
- length → int
-
Returns the number of elements in this collection.
no setterinherited
-
objects
→ Iterable<
DataObject> -
Returns an iterable for childs that can be represented as DataObject.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
array(
int key) → DataArray -
Returns a child data array at
key
.inherited -
arraysToList<
T extends Object> (T map(DataArray array), {int? limit}) → List< T> -
Returns a list of
T
mapped from child data arrays usingmap
function.inherited -
encodeJson(
{Object encodeTime(DateTime time)?}) → String -
Encodes this element into a JSON string.
inherited
-
exists(
int key) → bool -
Returns true if the
key
references an existing value, null or non-null.inherited -
existsNonNull(
int key) → bool -
Returns true if a value at
key
exists and that value is non-null.inherited -
existsNull(
int key) → bool -
Returns true if a value at
key
exists and that value is null.inherited -
getBigInt(
int key, {BigInt? min, BigInt? max}) → BigInt -
Returns a value at
key
asBigInt
.inherited -
getBool(
int key) → bool -
Returns a value at
key
asbool
.inherited -
getDouble(
int key, {double? min, double? max}) → double -
Returns a value at
key
asdouble
.inherited -
getId(
int key) → Identifier -
Returns a value at
key
as Identifier.inherited -
getInt(
int key, {int? min, int? max}) → int -
Returns a value at
key
asint
.inherited -
getNum(
int key, {num? min, num? max}) → num -
Returns a value at
key
asnum
.inherited -
getString(
int key) → String -
Returns a value at
key
asString
.inherited -
getTimeUTC(
int key, {DateTime parse(Object?)?}) → DateTime -
Returns a value at
key
asDateTime
in the UTC time zone.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
object(
int key) → DataObject -
Returns a child data object at
key
.inherited -
objectsToList<
T extends Object> (T map(DataObject object), {int? limit}) → List< T> -
Returns a list of
T
mapped from child data objects usingmap
function.inherited -
toNullableValues<
T extends Object> () → Iterable< T?> -
Returns all values as an iterable of
T?
. -
toString(
) → String -
A string representation of this object.
inherited
-
toValues<
T extends Object> () → Iterable< T> -
Returns all values as an iterable of
T
. -
tryArray(
int key) → DataArray? -
Returns a child data array at
key
or null if missing.inherited -
tryBigInt(
int key, {BigInt? min, BigInt? max}) → BigInt? -
Returns a value at
key
asBigInt
or null if missing.inherited -
tryBool(
int key) → bool? -
Returns a value at
key
asbool
or null if missing.inherited -
tryDouble(
int key, {double? min, double? max}) → double? -
Returns a value at
key
asdouble
or null if missing.inherited -
tryId(
int key) → Identifier? -
Returns a value at
key
as Identifier or null if missing.inherited -
tryInt(
int key, {int? min, int? max}) → int? -
Returns a value at
key
asint
or null if missing.inherited -
tryNum(
int key, {num? min, num? max}) → num? -
Returns a value at
key
asnum
or null if missing.inherited -
tryObject(
int key) → DataObject? -
Returns a child data object at
key
or null if missing.inherited -
tryString(
int key) → String? -
Returns a value at
key
asString
or null if missing.inherited -
tryTimeUTC(
int key, {DateTime parse(Object?)?}) → DateTime? -
Returns a value at
key
asDateTime
in the UTC time zone, or null.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int key) → Object? -
Returns a value at
key
, the result can be of any object or null.inherited