HTStruct class
A prototype based dynamic object. You can define and delete members in runtime. Use prototype to create and extends from other object. Can be named or anonymous. Unlike class, you have to use 'this' to access struct member within its own methods a HTStruct in Dart side works just like a normal Map you can access and modify its member via '[]' operator and it has several same apis like Map, e.g. contains, remove, etc.
- Mixed-in types
Constructors
-
HTStruct(HTInterpreter interpreter, {String? id, HTStruct? prototype, bool isPrototypeRoot = false, Map<
String, dynamic> ? fields, HTNamespace? closure})
Properties
- closure → HTNamespace?
-
final
- declaration ↔ HTNamedStruct?
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
final
- interpreter → HTInterpreter
-
final
- isEmpty → bool
-
Whether there is no key/value pair in the map.
no setter
- isNotEmpty → bool
-
Whether there is at least one key/value pair in the map.
no setter
- isPrototypeRoot → bool
-
final
-
keys
→ Iterable<
String> -
no setter
- length → int
-
The number of key/value pairs in the map.
no setter
- namespace ↔ HTNamespace
-
latefinal
- prototype ↔ HTStruct?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- values → Iterable
-
no setter
- valueType → HTStructuralType
-
no setteroverride
Methods
-
assign(
HTStruct other) → void - deep copy another struct then assign to this one. existed value with same id in this struct will be overrided
-
clear(
) → void -
clone(
{bool withInternals = false}) → HTStruct - return a deep copy of this struct.
-
contains(
String? id) → bool -
Check if this struct has the key in its own _fields or its prototypes' _fields
override
-
containsKey(
String? id) → bool - Check if this struct has the key in its own _fields
-
define(
String id, dynamic value, {bool override = false, bool throws = true}) → void -
override
-
help(
) → String -
import(
HTStruct other, {bool clone = false}) → void -
memberGet(
dynamic id, {String? from, bool isRecursive = false, bool ignoreUndefined = true, HTStruct? caller}) → dynamic -
Fetch a member by the
id, in the form ofoverride -
memberSet(
dynamic id, dynamic value, {String? from, bool defineIfAbsent = true}) → bool -
Assign a value to a member by the
id, in the form ofoverride -
merge(
HTStruct other) → void - deep copy another struct then merge with this one. only copy the fields that this struct doesn't have.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String? id) → void -
removeWhere(
bool test(String key, dynamic value)) → void -
subGet(
dynamic id, {String? from}) → dynamic -
Fetch a member by the
id, in the form ofoverride -
subSet(
dynamic id, dynamic value, {String? from}) → void -
Assign a value to a member by the
id, in the form ofoverride -
toJSON(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
dynamic key) → dynamic -
operator []=(
dynamic key, dynamic value) → void
Static Properties
- structLiteralIndex ↔ int
-
getter/setter pair