NotifiableSet<E> class
Class that mimics Set, and notify its listener every time the set is changed.
This set will notify its listener when a change is detected (an item has been added, removed, updated, etc... or the set has been sorted, mapped, etc...). However, it won't notify its listener if its items are changed, even if they extends ChangeNotifier.
- Inheritance
-
- Object
- ChangeNotifier
- NotifiableSet
- Implemented types
-
- Set<
E>
- Set<
- Available extensions
Constructors
- NotifiableSet({dynamic propagateNotification = true})
- Create an empty NotifiableSet.
- NotifiableSet.from(Iterable elements, {dynamic propagateNotification = true})
-
Create a NotifiableSet by adding all elements from
elements
, regardless of their type. -
NotifiableSet.of(Iterable<
E> elements, {dynamic propagateNotification = true}) -
Create a NotifiableSet by adding all elements of
elements
of typeE
.
Properties
- first → E
-
The first element.
no setteroverride
- firstOrNull → T?
-
Available on Iterable<
The first element of this iterator, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
indexed
→ Iterable<
(int, T)> -
Available on Iterable<
Pairs of elements of the indices and elements of this iterable.T> , provided by the IterableExtensions extensionno setter - isEmpty → bool
-
Whether this collection has no elements.
no setteroverride
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setteroverride
-
iterator
→ Iterator<
E> -
An iterator that iterates over the elements of this set.
no setteroverride
- last → E
-
The last element.
no setteroverride
- lastOrNull → T?
-
Available on Iterable<
The last element of this iterable, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - length → int
-
The number of elements in this Iterable.
no setteroverride
-
nonNulls
→ Iterable<
T> -
Available on Iterable<
The non-T?> , provided by the NullableIterableExtensions extensionnull
elements of this iterable.no setter - propagateNotification ↔ bool
-
The boolean that indicates if the notification from its children should
propagate.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → E
-
Checks that this iterable has only one element, and returns that element.
no setteroverride
- singleOrNull → T?
-
Available on Iterable<
The single element of this iterator, orT> , provided by the IterableExtensions extensionnull
.no setter -
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures in parallel.Future< , provided by the FutureIterable extensionT> >no setter
Methods
-
add(
E element) → bool -
Adds
value
to the set.override -
addAll(
Iterable< E> elements) → void -
Adds all
elements
to this set.override -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
any(
bool test(E element)) → bool -
Checks whether any element of this iterable satisfies
test
.override -
asMap(
) → Map< int, E> - Return a Map where the keys are the indices and the values the elements of this set.
-
asNameMap(
) → Map< String, T> -
Available on Iterable<
Creates a map from the names of enum values to the values.T> , provided by the EnumByName extension -
asNotifiableMap(
) → NotifiableMap< int, E> - Return a NotifiableMap where the keys are the indices and the values the elements of this set.
-
byName(
String name) → T -
Available on Iterable<
Finds the enum value in this list with nameT> , provided by the EnumByName extensionname
. -
cast<
R> () → Set< R> -
Provides a view of this set as a set of
R
instances.override -
clear(
) → void -
Removes all elements from the set.
override
-
contains(
Object? E) → bool -
Whether
value
is in the set.override -
containsAll(
Iterable< Object?> other) → bool -
Whether this set contains all the elements of
other
.override -
difference(
Set< Object?> other) → NotifiableSet<E> -
Creates a new set with the elements of this that are not in
other
.override -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
elementAt(
int index) → E -
Returns the
index
th element.override -
elementAtOrNull(
int index) → T? -
Available on Iterable<
The element at positionT> , provided by the IterableExtensions extensionindex
of this iterable, ornull
. -
every(
bool test(E element)) → bool -
Checks whether every element of this iterable satisfies
test
.override -
expand<
T> (Iterable< T> f(E element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
override
-
firstWhere(
bool test(E element), {E orElse()?}) → E -
The first element that satisfies the given predicate
test
.override -
fold<
T> (T initialValue, T combine(T previousValue, E element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
override
-
followedBy(
Iterable< E> other) → Iterable<E> -
Creates the lazy concatenation of this iterable and
other
.override -
forEach(
void f(E element)) → void -
Invokes
action
on each element of this iterable in iteration order.override -
indexOf(
E element, [int start = 0]) → int -
Search for
element
starting fromstart
and return its index. -
indexWhere(
bool test(E element), [int start = 0]) → int -
Iterate over the set and return the first element matching
test
. -
insert(
int index, E element) → bool -
Insert
element
in the set atindex
. -
intersection(
Set< Object?> other) → NotifiableSet<E> -
Creates a new set which is the intersection between this set and
other
.override -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
override
-
lastWhere(
bool test(E element), {E orElse()?}) → E -
The last element that satisfies the given predicate
test
.override -
lookup(
Object? object) → E? -
If an object equal to
object
is in the set, return it.override -
map<
T> (T f(E e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
reduce(
E combine(E value, E element)) → E -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
override
-
remove(
Object? E) → bool -
Removes
value
from the set.override -
removeAll(
Iterable< Object?> elements) → void -
Removes each element of
elements
from this set.override -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
removeWhere(
bool test(E element)) → void -
Removes all elements of this set that satisfy
test
.override -
replace(
E oldValue, E newValue) → void -
Replace the
oldValue
withnewValue
if found. -
retainAll(
Iterable< Object?> elements) → void -
Removes all elements of this set that are not elements in
elements
.override -
retainWhere(
bool test(E element)) → void -
Removes all elements of this set that fail to satisfy
test
.override -
singleWhere(
bool test(E element), {E orElse()?}) → E -
The single element that satisfies
test
.override -
skip(
int count) → Iterable< E> -
Creates an Iterable that provides all but the first
count
elements.override -
skipWhile(
bool test(E value)) → Iterable< E> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.override -
take(
int count) → Iterable< E> -
Creates a lazy iterable of the
count
first elements of this iterable.override -
takeWhile(
bool test(E value)) → Iterable< E> -
Creates a lazy iterable of the leading elements satisfying
test
.override -
toList(
{bool growable = true}) → List< E> -
Creates a List containing the elements of this Iterable.
override
-
toNotifiableList(
{bool growable = true}) → NotifiableList< E> - Create a NotifiableList containing the same elements as this set.
-
toNotifiableSet(
) → NotifiableSet< E> - Creates a NotifiableSet containing the same elements as this set.
-
toSet(
) → Set< E> -
Creates a Set with the same elements and behavior as this
Set
.override -
toString(
) → String -
A string representation of this object.
inherited
-
union(
Set< E> other) → NotifiableSet<E> -
Creates a new set which contains all the elements of this set and
other
.override -
update(
int index, E newValue) → E -
Set the element at
index
tonewValue
. -
where(
bool test(E element)) → Iterable< E> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.override -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.override
Operators
-
operator +(
Iterable< E> other) → NotifiableSet<E> -
Creates a new NotifiableSet that contains the elements of this set and the elements of
other
in that order. -
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
int index) → E -
Returns the element at
index
. -
operator []=(
int index, E value) → void -
Update the element at
index
with the new valuevalue
.