GeneralBloomElementsExtension<E> extension

Reactive extensions on BloomIterableElements providing collection utilities.

Architectural Benefits

All transformation methods (such as sorted, shuffled, whereNot, slices, groupListsBy) compute lazily and return immutable List.unmodifiable collections to prevent unexpected side-effects and preserve reactive state isolation.

Data Propagation Flow

[Source Bloom<Iterable<E>>]
       │ (Push-Dirty)
       ▼
[Grouping & Slicing Operator Pipeline]
       ├─► .slices(3)         ──► Chunked Bloom<List<List<E>>>
       ├─► .groupListsBy(key) ──► Grouped Bloom<Map<K, List<E>>>
       ├─► .sample(n)         ──► Randomized Bloom<List<E>>
       └─► .sortedBy(key)     ──► Sorted Bloom<List<E>>

Examples

final numbers = blooming([1, 2, 3, 4, 5, 6, 7]);
final chunks = numbers.bloom.elements.slices(3);
final evenOdd = numbers.bloom.elements.groupListsBy((n) => n % 2 == 0 ? 'even' : 'odd');

print(untracked(chunks));  // [[1, 2, 3], [4, 5, 6], [7]]
print(untracked(evenOdd)); // {'odd': [1, 3, 5, 7], 'even': [2, 4, 6]}
on

Methods

anyIndexed(bool test(int index, E element)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if any element satisfies an indexed predicate test reactively.
elementAtOrNull(int index) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the indexth element reactively, or null if out of range.
everyIndexed(bool test(int index, E element)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if all elements satisfy an indexed predicate test reactively.
expandIndexed<T>(Iterable<T> toElements(int index, E element)) → Bloom<List<T>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Flattens this collection along with element indices reactively.
firstWhereIndexedOrNull(bool test(int index, E element)) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the first element that satisfies an indexed predicate test reactively, or null if none.
firstWhereOrNull(bool test(E element)) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the first element that satisfies test reactively, or null if none.
foldIndexed<T>(T initialValue, T combine(int index, T previous, E element)) → Bloom<T>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Reduces this collection to a single value by iteratively combining elements along with their index and an initial value reactively.
groupBy<K>(K key(E element)) → Bloom<Map<K, List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Legacy alias of groupListsBy.
groupFoldBy<K, G>({required K key(E element), required G fold(G? previous, E element)}) → Bloom<Map<K, G>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Groups and folds elements by a key computed from each element reactively.
groupListsBy<K>(K keyOf(E element)) → Bloom<Map<K, List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Groups elements into lists by keyOf reactively.
groupSetsBy<K>(K keyOf(E element)) → Bloom<Map<K, Set<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Groups elements into sets by keyOf reactively.
isSorted(int compare(E a, E b)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if this collection is sorted by compare reactively.
isSortedBy<K extends Comparable>(K keyOf(E element)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if this collection is sorted by the natural order of keyOf reactively.
isSortedByCompare<K>(K keyOf(E element), int compare(K a, K b)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if this collection is sorted by compare of keyOf reactively.
lastBy<K>(K key(E element)) → Bloom<Map<K, E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Groups elements by key reactively, keeping only the last element for each key.
lastWhereIndexedOrNull(bool test(int index, E element)) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the last element that satisfies an indexed predicate test reactively, or null if none.
lastWhereOrNull(bool test(E element)) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the last element that satisfies test reactively, or null if none.
mapIndexed<T>(T convert(int index, E element)) → Bloom<List<T>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Maps each element of this collection along with its index reactively.
none(bool test(E element)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if no elements satisfy test reactively.
noneIndexed(bool test(int index, E element)) → Bloom<bool>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns true if no elements satisfy an indexed predicate test reactively.
reduceIndexed(E combine(int index, E previous, E element)) → Bloom<E>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Reduces this collection to a single value by iteratively combining elements along with their index reactively.
sample(int count, [Random? random]) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Selects count elements at random from this collection reactively.
shuffled([Random? random]) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns a list containing the elements of this collection shuffled reactively.
singleWhereIndexedOrNull(bool test(int index, E element)) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the single element that satisfies an indexed predicate test reactively, or null if none.
singleWhereOrNull(bool test(E element)) → Bloom<E?>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns the single element that satisfies test reactively, or null if none.
slices(int size) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection into chunks of size elements reactively.
sorted(int compare(E a, E b)) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns a list containing the elements of this collection sorted by compare reactively.
sortedBy<K extends Comparable>(K keyOf(E element)) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns a list containing the elements of this collection sorted by keyOf reactively.
sortedByCompare<K>(K keyOf(E element), int compare(K a, K b)) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns a list containing the elements of this collection sorted by compare of keyOf reactively.
splitAfter(bool test(E element)) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection after elements satisfying test reactively.
splitAfterIndexed(bool test(int index, E element)) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection into chunks after elements satisfying an indexed predicate test reactively.
splitBefore(bool test(E element)) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection into chunks before elements satisfying test reactively.
splitBeforeIndexed(bool test(int index, E element)) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection into chunks before elements satisfying an indexed predicate test reactively.
splitBetween(bool test(E first, E second)) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection into chunks between elements satisfying test reactively.
splitBetweenIndexed(bool test(int index, E first, E second)) → Bloom<List<List<E>>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Splits this collection into chunks between elements satisfying an indexed predicate test reactively.
whereIndexed(bool test(int index, E element)) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Filters elements of this collection based on an indexed predicate test reactively.
whereNot(bool test(E element)) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Returns a list of elements that do not satisfy test reactively.
whereNotIndexed(bool test(int index, E element)) → Bloom<List<E>>

Available on BloomIterableElements<E>, provided by the GeneralBloomElementsExtension extension

Filters elements of this collection based on an indexed predicate test reactively, returning those that do not satisfy it.