DataObjectView<Obj extends DataObject, Arr extends DataArray> class
base
A base implemention of DataObject as a view of Map<String, Object?>
source data.
As this class is defined with the class modifier base
, the class can
only be extended, but not implemented. When a subtype should be defined with
implements
, then such a subtype should implement DataObject
.
- Implemented types
- Mixed-in types
Constructors
-
DataObjectView(Map<
String, Object?> map, {bool isExposed = false}) -
Creates a data object view wrapping a source
map
.const
Properties
-
arrays
→ Iterable<
Arr> -
Returns an iterable for childs that can be represented as DataArray.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Returns true if the collection has no elements.
no setteroverride
- isExposed → bool
-
Whether map is (potentially) exposed to side effects.
final
- isNotEmpty → bool
-
Returns true if the collection has at least one element.
no setteroverride
-
keys
→ Iterable<
String> -
Returns map keys.
no setteroverride
- length → int
-
Returns the number of elements in this collection.
no setteroverride
-
map
→ Map<
String, Object?> -
Wrapped map containing map entries view by this class as DataObject.
final
-
objects
→ Iterable<
Obj> -
Returns an iterable for childs that can be represented as DataObject.
no setteroverride
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited
Methods
-
array(
String key) → Arr -
Returns a child data array at
key
.override -
arraysToList<
T extends Object> (T map(Arr array), {int? limit}) → List< T> -
Returns a list of
T
mapped from child data arrays usingmap
function.override -
encodeJson(
{Object encodeTime(DateTime time)?}) → String -
Encodes this element into a JSON string.
override
-
exists(
String key) → bool -
Returns true if the
key
references an existing value, null or non-null.override -
existsNonNull(
String key) → bool -
Returns true if a value at
key
exists and that value is non-null.inherited -
existsNull(
String key) → bool -
Returns true if a value at
key
exists and that value is null.inherited -
getBigInt(
String key, {BigInt? min, BigInt? max}) → BigInt -
Returns a value at
key
asBigInt
.inherited -
getBool(
String key) → bool -
Returns a value at
key
asbool
.inherited -
getDouble(
String key, {double? min, double? max}) → double -
Returns a value at
key
asdouble
.inherited -
getId(
String key) → Identifier -
Returns a value at
key
as Identifier.inherited -
getInt(
String key, {int? min, int? max}) → int -
Returns a value at
key
asint
.inherited -
getNum(
String key, {num? min, num? max}) → num -
Returns a value at
key
asnum
.inherited -
getString(
String key) → String -
Returns a value at
key
asString
.inherited -
getTimeUTC(
String key, {DateTime parse(Object?)?}) → DateTime -
Returns a value at
key
asDateTime
in the UTC time zone.inherited -
newArrayView(
Iterable< Object?> source) → Arr - Do not use directly, only from sub classes (marked @protected).
-
newEnsureProtected(
Map< String, Object?> source) → Obj - Do not use directly, only from sub classes (marked @protected).
-
newExposed(
Map< String, Object?> source) → Obj - Do not use directly, only from sub classes (marked @protected).
-
newProtected(
Map< String, Object?> source) → Obj - Do not use directly, only from sub classes (marked @protected).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
object(
String key) → Obj -
Returns a child data object at
key
.override -
objectsToList<
T extends Object> (T map(Obj object), {int? limit}) → List< T> -
Returns a list of
T
mapped from child data objects usingmap
function.override -
toEncodable(
) → Map< String, Object?> -
Returns data as an encodable object compatible with
json.encode()
. -
toJson(
) → Map< String, Object?> -
Returns data as an encodable object compatible with
json.encode()
.override -
toNullableValueMap<
T extends Object> () → Map< String, T?> -
Returns map items (key-value pairs) with values represented as
T?
.override -
toString(
) → String -
A string representation of this object.
override
-
toValueMap<
T extends Object> () → Map< String, T> -
Returns map items (key-value pairs) with values represented as
T
.override -
tryArray(
String key) → Arr? -
Returns a child data array at
key
or null if missing.override -
tryBigInt(
String key, {BigInt? min, BigInt? max}) → BigInt? -
Returns a value at
key
asBigInt
or null if missing.inherited -
tryBool(
String key) → bool? -
Returns a value at
key
asbool
or null if missing.inherited -
tryDouble(
String key, {double? min, double? max}) → double? -
Returns a value at
key
asdouble
or null if missing.inherited -
tryId(
String key) → Identifier? -
Returns a value at
key
as Identifier or null if missing.inherited -
tryInt(
String key, {int? min, int? max}) → int? -
Returns a value at
key
asint
or null if missing.inherited -
tryNum(
String key, {num? min, num? max}) → num? -
Returns a value at
key
asnum
or null if missing.inherited -
tryObject(
String key) → Obj? -
Returns a child data object at
key
or null if missing.override -
tryString(
String key) → String? -
Returns a value at
key
asString
or null if missing.inherited -
tryTimeUTC(
String 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 [](
String key) → Object? -
Returns a value at
key
, the result can be of any object or null.override