IterableExtensions<T> extension
Properties
-
firstOrNull
→ T?
-
Returns the first element.
no setter
-
lastOrNull
→ T?
-
Returns the last element.
no setter
Methods
-
containsAll(Iterable<Object?> elements)
→ bool
-
Returns
true
if all of the given elements
is in the list.
-
containsAny(Iterable<Object?> elements)
→ bool
-
Returns
true
if any of the given elements
is in the list.
-
distinct()
→ List<T>
-
Remove duplicate values from the list.
-
expandAndRemoveEmpty<TCast>(Iterable<TCast?> callback(T item))
→ List<TCast>
-
After replacing the data in the list through
callback
, delete the Null.
-
firstWhereOrNull(bool test(T item))
→ T?
-
Returns the first value found by searching based on the condition specified in
test
.
-
index(T callback(T item, int index))
→ Iterable<T>
-
Index and loop it through
callback
.
-
limit(int start, int end)
→ List<T>
-
Extract an array with a given range between
start
and end
.
-
limitEnd(int end)
→ List<T>
-
Extract an array with a given range at
end
.
-
limitStart(int start)
→ List<T>
-
Extract an array with a given range at
start
.
-
mapAndRemoveEmpty<TCast>(TCast? callback(T item))
→ List<TCast>
-
After replacing the data in the list, delete the null.
-
setWhere<K extends Object>(Iterable<T> others, {required bool test(T original, T other), required K? apply(T original, T other), K? orElse(T original)?})
→ Iterable<K>
-
The data in the list of
others
is conditionally given to the current list.
-
split(int length)
→ Iterable<Iterable<T>>
-
Divides the array by the specified
length
into an array.
-
toMap<K, V>({K key(dynamic e)?, V value(dynamic e)?})
→ Map<K, V>
-
Creates a Map instance in which the keys and values are computed from the
iterable
.