RIterable<T> extension
RIterable
- on
-
- Iterable<
T>
- Iterable<
Properties
- random → T
-
- return a random element from list ! throws
StateError
if list is emptyno setter - return a random element from list ! throws
Methods
-
asyncMap<
S> (FutureOr< S> action(T e)) → Future<List< S> > -
- async Map
-
atOr(
int index, T value) → T -
- return element by index
- return
value
if index out of range -
atOrNull(
int index) → T? -
- return element by index
- return
null
if index out of range -
count(
[bool mapper(T element)?]) → int -
- alias for
length
- but can filter before if needed
- alias for
-
countNotNull(
) → int -
- return the
length
of the NOTnull
elements - return the
-
countValue(
T value) → int - counter the element of certain value
-
firstOr(
T value) → T -
- return first element if list is not empty
- return
value
if isEmpty -
firstOrNull(
) → T? -
- return the first element
- return
null
if isEmpty -
firstWhereOrNull(
bool test(T e)) → T? -
- return the first match
- return null if there is no match
-
lastOr(
T value) → T -
- return the last element
- return
value
if isEmpty -
lastOrNull(
) → T? -
- return the last element
- return
null
if isEmpty -
loop(
FutureOr< void> action(T e)) → Future<void> -
- async for each
-
mapWithIndex<
E> (E mapper(int index, T element)) → List< E> -
- like
map()
function but now you have the index with the element - like
-
notContains(
Iterable< T> input) → bool - return true if iterable not contains input
-
randomOr(
T e) → T -
- return a random element from list or the e if list is empty
-
withoutDuplicate(
) → List< T> -
- return a new
List
without duplicatedelements
- return a new