IterableExtensions<T> extension

Provides extended methods for T arrays.

Tの配列用の拡張メソッドを提供します。

on

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 Iterable contains all elements.
containsAny(Iterable<Object?> elements) bool
Returns true if Iterable contains any of elements.
distinct([Object key(T element)?]) List<T>
Deletes duplicate elements in an array.
equalsTo(Iterable<T> others) bool
Returns true if the internals of Iterable and others are compared and match.
expandAndRemoveEmpty<TCast>(Iterable<TCast?> callback(T item)) List<TCast>
Each element of the list is converted to TCast data using callback.
firstWhereOrNull(bool test(T item)) → T?
Returns the first element for which the return value of test is true.
insertEvery(T value, int per) Iterable<T>
Inserts a value element for each per of Iterable.
lastWhereOrNull(bool test(T item)) → T?
Returns the last element for which the return value of test is true.
limit(int start, int end) List<T>
Extract only the elements from start to end of Iterable.
limitEnd(int end) List<T>
Extract only the elements to end of Iterable.
limitStart(int start) List<T>
Extract only the elements from start of Iterable.
mapAndRemoveEmpty<TCast>(TCast? callback(T item)) List<TCast>
Each element of the list is converted to TCast data using callback.
print() → void
print the entire contents of List.
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>
If others is given to Iterable and the return value of test is true, the return value of apply is replaced with the corresponding value of Iterable.
split(int length) Iterable<Iterable<T>>
Iterable is divided into length elements each, creating a list of lists.
splitWhere(bool test(T a, T b)) Iterable<Iterable<T>>
Groups Iterable together with elements that have a return value of true for test and returns a list of each group.
toMap<K, V>(MapEntry<K, V>? f(T item)) Map<K, V>
The callback given by f from Iterable will create a map of K and V.