NexusSet<T> class

NexusSet — A reactive, observable set with granular change tracking.

Mutates in-place and provides precise NexusChange records describing what elements were added or removed.

Usage

final tags = NexusSet<String>({'combat', 'stealth'});

tags.add('magic');      // NexusSetAdd('magic')
tags.remove('stealth'); // NexusSetRemove('stealth')
tags.toggle('combat');  // NexusSetRemove('combat') — removes if present
tags.toggle('archery'); // NexusSetAdd('archery') — adds if absent

In a Pillar

class TagPillar extends Pillar {
  late final tags = nexusSet<String>({'dart', 'flutter'});
  late final tagCount = derived(() => tags.length);
}
Inheritance
Available extensions

Constructors

NexusSet({Set<T>? initial, String? name})
Creates a reactive set with optional initial elements.

Properties

conduits List<Conduit<Set<T>>>
The list of currently attached Conduits (read-only view).
no setterinherited
dependentCount int
The number of active dependents.
no setterinherited
elements Iterable<T>
Returns the elements (auto-tracked).
no setter
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this node has been disposed.
no setterinherited
isEmpty bool
Whether the set is empty.
no setter
isNotEmpty bool
Whether the set has at least one element.
no setter
lastChange NexusChange<T>?
The most recent change record.
no setter
length int
The number of elements.
no setter
listenerCount int
The number of active listeners.
no setterinherited
name String?
The debug name of this state, if provided.
no setterinherited
onChange Stream<void>

Available on ReactiveNode, provided by the FluxNodeExtensions extension

Converts this node to a stream that emits on every change.
no setter
previousValue Set<T>?
The previous value before the most recent change.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Set<T>
The current value.
getter/setter pairinherited

Methods

add(T element) bool
Adds element to the set.
addAll(Iterable<T> elements) → void
Adds all elements to the set.
addConduit(Conduit<Set<T>> conduit) → void
Adds a Conduit to this Core's pipeline.
inherited
addListener(ReactiveListener listener) → void
Adds an imperative listener that is called when this node changes.
inherited
clear() → void
Removes all elements from the set.
clearConduits() → void
Removes all Conduits from this Core.
inherited
contains(T element) bool
Whether the set contains element.
difference(Set<T> other) Set<T>
Returns the difference (this - other).
dispose() → void
Disposes this node, clearing all dependents and listeners.
inherited
intersection(Set<T> other) Set<T>
Returns the intersection with other.
listen(void callback(Set<T> value)) → void Function()
Listens for value changes with a typed callback.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyDependents() → void
Notifies all dependents and listeners that this node changed.
inherited
onDependencyChanged(ReactiveNode dependency) → void
Called when a dependency of this node has changed.
inherited
onTracked(ReactiveNode source) → void
Called when this node is registered as tracking source.
inherited
peek() Set<T>
Returns the current value without tracking it as a dependency.
inherited
remove(T element) bool
Removes element from the set.
removeConduit(Conduit<Set<T>> conduit) bool
Removes a previously added Conduit.
inherited
removeListener(ReactiveListener listener) → void
Removes a previously added listener.
inherited
removeWhere(bool test(T element)) int
Removes all elements matching test.
retainWhere(bool test(T element)) int
Retains only elements matching test.
select<R>(R selector(Set<T> value)) TitanComputed<R>
Creates a TitanComputed that selects a sub-value from this state.
inherited
silent(Set<T> newValue) → void
Silently sets the value without notifying dependents.
inherited
toggle(T element) bool
Toggles element: adds if absent, removes if present.
toString() String
A string representation of this object.
override
track() → void
Registers the current tracker (if any) as a dependent of this node.
inherited
union(Set<T> other) Set<T>
Returns the union with other.
update(Set<T> updater(Set<T> current)) → void
Updates the value using a transformation function.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited