StructBase<S extends StructBase<S, K, V> , K extends Field<V> , V> mixin
StructBase — abstract base user subtype
TypedStruct holds data and List keys TypeObject
provide toMap()
Handle User Subtype + Serailizable mixin
mixin for convience, applies to further abstract classes
Unlike StructData (which wraps an external object), subclasses of
StructBase hold data directly in their own fields. Field.getIn /
Field.setIn receive this as the host object.
StructBase provides opt-in value equality via keys. When K also
extends Enum, the existing EnumMapByName extension on Map<Enum, V>
gives serialization for free — just call toMap().toJson().
StructureBase cannot implement StructData (an extension type). Instead,
data returns StructData<K, V>(this) — a zero-cost wrapper around this
— so that all keyed access delegates through the same Field-based dispatch.
This also allows inner to be passed to APIs that accept StructData<K, V>.
- Mixin applications
Properties
-
data
→ StructData<
K, V> -
Proxy to allow the same keys
Object as StructData<K, V> data passed to Keys
no setter
-
fields
→ Iterable<
StructField< K, V> > -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ List<
K> -
a method from its TypeObject
The ordered list of keys — defines the schema.
Typically returns
MyField.valuesfor an enum-based key type.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
V> -
no setter
Methods
-
field(
K key) → StructField< K, V> -
fieldAs<
R> (Field< R> key) → StructField<Field< R> , R> -
fieldOrNull(
K key) → V? -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< K, V> -
Snapshot as an IndexMap. If
K extends Enum, call.toJson()on the result to serialise via EnumMapByName. -
toString(
) → String -
A string representation of this object.
inherited
-
trySetField(
K key, V value) → bool
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
covariant K key) → V -
operator []=(
covariant K key, V value) → void