MapSignalImpl<K, V> class
Implementation of MapSignal that automatically notifies subscribers when modified.
This is the concrete implementation of the MapSignal interface. MapSignal extends Signal to provide full Map functionality while maintaining reactivity. All map operations (put, remove, clear, etc.) will trigger notifications to subscribers.
See MapSignal for the public interface and usage examples.
Example:
final userMap = MapSignal<String, dynamic>({'name': 'Alice', 'age': 30});
Effect(() => print('User: ${userMap['name']}, Age: ${userMap['age']}'));
// Prints: "User: Alice, Age: 30"
userMap['name'] = 'Bob';
// Prints: "User: Bob, Age: 30"
userMap['city'] = 'New York';
// Prints: "User: Bob, Age: 30" (if city is not used in effect)
userMap.addAll({'age': 25, 'country': 'USA'});
// Prints: "User: Bob, Age: 25"
userMap.clear();
// Prints: "User: null, Age: null"
- Inheritance
-
- Object
- ReactiveNode
- SignalReactiveNode<
Map< K, V> > - SignalImpl<
Map< K, V> > - MapSignalImpl
- Implemented types
-
- MapSignal<
K, V>
- MapSignal<
- Mixed-in types
-
- MapSignalMixin<
K, V>
- MapSignalMixin<
- Available extensions
Constructors
-
MapSignalImpl(Map<
K, V> ? value, {JoltDebugFn? onDebug}) - Creates a reactive map signal with the given initial map.
Properties
-
cachedValue
↔ Map<
K, V> ? -
getter/setter pairinherited
- deps ↔ Link?
-
First dependency link in the chain.
getter/setter pairinherited
- depsTail ↔ Link?
-
Last dependency link in the chain.
getter/setter pairinherited
-
entries
→ Iterable<
MapEntry< K, V> > -
The map entries of this map.
no setterinherited
- flags ↔ int
-
Reactive flags for this node.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether this node has been disposed.
no setterinherited
- isEmpty → bool
-
Whether this map is empty.
no setterinherited
- isNotEmpty → bool
-
Whether this map is not empty.
no setterinherited
-
keys
→ Iterable<
K> -
The keys of this map.
no setterinherited
- length → int
-
The number of key-value pairs in the map.
no setterinherited
-
peek
→ Map<
K, V> -
Returns the current value without establishing a reactive dependency.
no setterinherited
-
pendingValue
↔ Map<
K, V> ? -
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subs ↔ Link?
-
First subscriber link in the chain.
getter/setter pairinherited
- subsTail ↔ Link?
-
Last subscriber link in the chain.
getter/setter pairinherited
-
value
↔ Map<
K, V> -
Returns the current value and establishes a reactive dependency.
getter/setter pairinherited
-
values
→ Iterable<
V> -
The values of this map.
no setterinherited
Methods
-
addAll(
Map< K, V> other) → void -
Adds all key-value pairs from the given map to this map.
inherited
-
addEntries(
Iterable< MapEntry< newEntries) → voidK, V> > -
Adds all entries from the given iterable to this map.
inherited
-
cast<
RK, RV> () → Map< RK, RV> -
Returns a view of this map as having
RKkeys andRVinstances.inherited -
clear(
) → void -
Removes all entries from the map.
inherited
-
containsKey(
Object? key) → bool -
Returns true if this map contains the given key.
inherited
-
containsValue(
Object? targetValue) → bool -
Returns true if this map contains the given value.
inherited
-
dispose(
) → void -
Disposes this node and cleans up resources.
inherited
-
forEach(
void action(K key, V value)) → void -
Applies the given function to each key-value pair in the map.
inherited
-
get(
) → Map< K, V> -
Returns the current value and establishes a reactive dependency.
inherited
-
map<
K2, V2> (MapEntry< K2, V2> convert(K key, V value)) → Map<K2, V2> -
Returns a new map where each entry is transformed by the given function.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void -
Manually notifies all subscribers that this signal has changed.
inherited
-
onDispose(
) → void -
Disposes the signal and cleans up resources.
inherited
-
putIfAbsent(
K key, V ifAbsent()) → V -
Look up the value of
key, or add a new entry if it isn't there.inherited -
remove(
Object? key) → V? -
Removes the entry for the given key and returns its value.
inherited
-
removeWhere(
bool test(K key, V value)) → void -
Removes all entries that satisfy the given test.
inherited
-
set(
Map< K, V> value) → Map<K, V> -
Sets a new value for the signal and notifies subscribers when it changes.
inherited
-
toMapSignal(
) → MapSignal< K, V> -
Available on Map<
Converts this map to a reactive map signal.K, V> , provided by the JoltMapExtension extension -
toString(
) → String -
A string representation of this object.
inherited
-
update(
K key, V update(V value), {V ifAbsent()?}) → V -
Updates the value for the given key.
inherited
-
updateAll(
V update(K key, V value)) → void -
Updates all values in the map.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
Object? key) → V? -
Gets the value associated with the given key.
inherited
-
operator []=(
K key, V value) → void -
Sets the value associated with the given key.
inherited