functions/functions
library
Functions
-
addAround<V>(List<V> list, Generator<V> generator)
→ List<V>
-
Returns new list with items generated around
list
-
addBetween<V>(List<V> list, Generator<V> generate)
→ List<V>
-
Returns new list with items generated between list.
-
containsAll<E>(Iterable<E> listA, Iterable<E> listB)
→ bool
-
Check if all elements in the
listB
is contains in the listA
-
containsAny<E>(Iterable<E> listA, Iterable<E> listB)
→ bool
-
Check if any elements in the
listB
is contains in the listA
-
containsAtLeast<E>(Iterable<E> listA, Iterable<E> listB, int atLeast)
→ bool
-
Check if
atLeast
elements in the listB
is contains in the listA
-
containsHits<E>(Iterable<E> listA, Iterable<E> listB)
→ int
-
Count of items that hit both lists
-
diff<V>(Iterable<V> listA, Iterable<V> listB)
→ List<V>
-
Elements that you have in
listA
and do not have in listB
.
-
firstOrNull<V>(Iterable<V> list)
→ V?
-
Returns first element in array, if it's empty returns null.
-
firstWhereOrAdd<V>(List<V> list, bool test(V element), OrAdd<V> orAdd)
→ V
-
Returns the first element that satisfies the test if there isn't one add a new one and return it.
-
firstWhereOrNull<T>(Iterable<T> iterable, bool test(T element))
→ T?
-
-
flat<V>(Iterable<V> list)
→ List<V>
-
Flatting a
list
that has other lists inside other lists inside other lists ... recursive
-
forEachAsync<V>(Iterable<V> source, Future<void> forEach(V elemente), [int parallels = 1])
→ Future<void>
-
Iterable elements of
source
with support async function and runs it's in parallels
-
groupBySize<V>(Iterable<V> source, int sizeEachList)
→ Iterable<Iterable<V>>
-
Groups the items from the list
source
into sub-lists of the size given in sizeEachList
-
intersection<V>(Iterable<V> listA, Iterable<V> listB)
→ Iterable<V>
-
Common elements between
listA
and listB
-
isFirst<V>(Iterable<V> list, V element)
→ bool
-
Returns a true value if element is the first in the list.
-
isFirstIndex<V>(Iterable<V> list, int index)
→ bool
-
Returns a true value if index is the first in the list.
-
isLast<V>(Iterable<V> list, V element)
→ bool
-
Returns a true value if element is the last in the list.
-
isLastIndex<V>(Iterable<V> list, int index)
→ bool
-
Returns a true value if index is the last in the list.
-
join<V>(Iterable<V> list, [String separator = '', String? last])
→ String
-
It joins all elements of the list with one separator and for the last iteration a different separator.
-
lastOrNull<V>(Iterable<V> list)
→ V?
-
Returns last element in array, if it's empty returns null.
-
lastWhereOrAdd<V>(List<V> list, bool test(V element), OrAdd<V> orAdd)
→ V
-
Returns the last element that satisfies the test if there isn't one add a new one and return it.
-
lastWhereOrNull<T>(Iterable<T> iterable, bool test(T element))
→ T?
-
-
mapAsStream<V>(Iterable<V> source, Future<V> forEach(V elemente), [int parallels = 1])
→ Stream<V>
-
Iterable elements of
source
with support async and emits each forEach
async end
-
mapAsync<V, R>(Iterable<V> source, Future<R> toElement(V element), [int parallels = 1])
→ Future<List<R>>
-
The current elements of
source
iterable modified by toElement
.
Runs in parallels
and return a Future<List>.
-
next<V>(List<V> list, int index)
→ V?
-
Returns an element following the index, if out of bounds returns null.
-
previous<V>(List<V> list, int index)
→ V?
-
Returns a preceding element in the index, if out of bounds returns null.
-
toMap<K, V>(Iterable<V> list, GeneratorKey<V, K> generatorKey)
→ Map<K, V>
-
Returns a Map with keys that's generated by generator.
-
toStream<V>(Iterable<V> list, [Duration? interval])
→ Stream<V>
-
Creates a stream with the items in the list.
Typedefs
-
Generator<G>
= G Function(int index, G? previous, G? next)
-
Type definition for callback that creates a new object based on index, previous and or next
-
GeneratorKey<GV, GK>
= GK Function(GV value)
-
Definition os callback that's return a key for the toMap function
-
OrAdd<O>
= O Function()
-
Type of the callback that's called when has no one element in firstWhereOrAdd and lastWhereOrAdd