SetSignal<E> class

Signal for Set with convenient mutation methods.

SetSignal provides reactive set operations while maintaining immutability.

Basic Usage

final tags = SetSignal<String>({'flutter', 'dart'});

// Add item
tags.add('reactive');

// Remove item
tags.remove('flutter');

// Check existence
if (tags.contains('dart')) { ... }
Inheritance

Constructors

SetSignal(Set<E> initial, {String? debugLabel, bool equals(Set<E> a, Set<E> b)?, Set<E> guard(Set<E> current, Set<E> next)?, VoidCallback? onListen, VoidCallback? onCancel})

Properties

debugLabel String?
Debug label for identification in DevTools.
finalinherited
equals bool Function(Set<E> a, Set<E> b)?
Custom equality function to determine if value has changed.
finalinherited
guard Set<E> Function(Set<E> current, Set<E> next)?
Value guard/transformer called before setting a new value.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether this atom has any listeners.
no setterinherited
initialValue Set<E>
The initial value of the atom.
no setterinherited
isDisposed bool
Whether this atom has been disposed.
no setterinherited
isEmpty bool
Check if set is empty.
no setter
isNotEmpty bool
Check if set is not empty.
no setter
length int
Get length of set.
no setter
onCancel VoidCallback?
Callback invoked when the last listener unsubscribes.
finalinherited
onListen VoidCallback?
Callback invoked when the first listener subscribes.
finalinherited
previousValue Set<E>?
The previous value of the atom (before the last change).
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<Set<E>>
A broadcast stream of value changes.
no setterinherited
val Set<E>
Short alias for the current value.
no setterinherited
value Set<E>
Override value getter to support dependency tracking for Computed.
getter/setter pairinherited

Methods

add(E element) bool
Add an element.
addAll(Iterable<E> elements) → void
Add multiple elements.
addListener(VoidCallback listener) → void
Adds a listener to be called when the value changes.
inherited
clear() → void
Clear all elements.
contains(E element) bool
Check if element exists.
dispose() → void
Disposes the atom, removing all listeners.
inherited
emit(Set<E> val) → void
Assigns a new value and notifies listeners if the value changed.
inherited
mutate(void mutator(Set<E> set)) → void
Mutate the set in-place and notify listeners.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Manually notifies all listeners.
inherited
onActive() → void
Called when the first listener is added.
inherited
onInactive() → void
Called when the last listener is removed.
inherited
remove(E element) bool
Remove an element.
removeListener(VoidCallback listener) → void
Removes a previously added listener.
inherited
reset() → void
Resets the atom to its initial value.
inherited
select<R>(R selector(Set<E> value)) NeuronAtom<R>
Creates a new atom that selects a part of this atom's value.
inherited
subscribe(VoidCallback listener) VoidCallback
Adds a listener and returns a callback that cancels the subscription when called.
inherited
toString() String
A string representation of this object.
inherited

Operators

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