TraitMap class

Implemented types

Constructors

TraitMap(Map<ShapeId, Trait<Object>> traits)
TraitMap.empty()
An empty TraitMap.
factory
TraitMap.fromTraits(Iterable<Trait<Object>> traits)
Creates a TraitMap from traits.
factory

Properties

entries → Iterable<MapEntry<ShapeId, Trait<Object>>>
The map entries of this Map.
no setterinherited
hashCode → int
The hash code for this object.
no setteroverride
isEmpty → bool
Whether there is no key/value pair in the map.
no setterinherited
isNotEmpty → bool
Whether there is at least one key/value pair in the map.
no setterinherited
keys → Iterable<ShapeId>
The keys of this Map.
no setterinherited
length → int
The number of key/value pairs in the map.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
values → Iterable<Trait<Object>>
The values of this Map.
no setterinherited

Methods

addAll(Map<ShapeId, Trait<Object>> other) → void
Adds all key/value pairs of other to this map.
inherited
addEntries(Iterable<MapEntry<ShapeId, Trait<Object>>> entries) → void
Adds all key/value pairs of newEntries to this map.
inherited
cast<K2, V2>() → Map<K2, V2>
Provides a view of this map as having RK keys and RV instances, if necessary.
inherited
clear() → void
Removes all entries from the map.
inherited
containsKey(Object? key) → bool
Whether this map contains the given key.
inherited
containsValue(Object? value) → bool
Whether this map contains the given value.
inherited
expectTrait<T extends Trait<Object>>() → T
Gets the trait of type T from the shape or throws if not found.
forEach(void f(ShapeId, Trait<Object>)) → void
Applies action to each key/value pair of the map.
inherited
getTrait<T extends Trait<Object>>() → T?
Returns the trait of type T, if it exists on the shape.
hasTrait<T extends Trait<Object>>() → bool
Whether the shape has a trait of type T.
map<K2, V2>(MapEntry<K2, V2> transform(ShapeId, Trait<Object>)) → Map<K2, V2>
Returns a new map where all entries of this map are transformed by the given convert function.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putIfAbsent(ShapeId key, Trait<Object> ifAbsent()) → Trait<Object>
Look up the value of key, or add a new entry if it isn't there.
inherited
remove(Object? key) → Trait<Object>?
Removes key and its associated value, if present, from the map.
inherited
removeWhere(bool test(ShapeId, Trait<Object>)) → void
Removes all entries of this map that satisfy the given test.
inherited
retype<K2, V2>() → Map<K2, V2>
inherited
toString() → String
A string representation of this object.
inherited
update(ShapeId key, Trait<Object> update(Trait<Object>), {Trait<Object> ifAbsent()?}) → Trait<Object>
Updates the value for the provided key.
inherited
updateAll(Trait<Object> update(ShapeId, Trait<Object>)) → void
Updates all values.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override
operator [](Object? key) → Trait<Object>?
The value for the given key, or null if key is not in the map.
inherited
operator []=(ShapeId key, Trait<Object> value) → void
Associates the key with the given value.
inherited