ListExtensions extension
List extension to extend List functionality
- on
Properties
- avg → num
-
Get average of numbers
no setter
- count → Map?
-
counts the occurrences of values in the list
no setter
- flatMap → Map
-
Expands each element of this Iterable into zero or more elements.
no setter
- flatten → List
-
Expands each element of this Iterable into zero or more elements.
no setter
- isEmptyOrNull → bool
-
check list is empty or null
no setter
- isNotEmptyOrNull → bool
-
check list is neither empty nor null
no setter
- max → dynamic
-
Get maximum number
no setter
- median → num
-
Get median of numbers
no setter
- min → dynamic
-
Get minimum number
no setter
- mode → num
-
Get mode of numbers
no setter
- random → dynamic
-
Returns random value from this list
no setter
- sum → num
-
Get sum of numbers
no setter
Methods
-
chunk(
int size) → List - The chunk method breaks the list into multiple, smaller list of a given size
-
countBy(
dynamic fn(dynamic)) → Map - counts the occurrences of values in the list if condition satisified
-
diff(
List list) → List - Creates a new list with the elements of this that are not in other.
-
groupBy(
dynamic fn(dynamic)) → Map< dynamic, List> - Group by objects according to key/value pair
-
groupByKey(
String key) → Map - Group the objects according to key/value pair and return list
-
hasKey(
dynamic key) → bool - Checks given key is exists or not
-
hasKeyValue(
String key, dynamic value) → bool - Checks given key/value is exists or not
-
hasValue(
dynamic value) → bool - Checks given value is exists or not
-
isNotNull(
String key) → bool - returns return true if the given key is not null
-
isNull(
String key) → bool - returns return true if the given key is null:
-
latest(
[String key = 'id']) → List - The latest methods allow you to easily order results by id in descending order. By default, the result will be ordered by the table's id column. Or, you may pass the column name that you wish to sort by:
-
latestFirst(
[String key = 'id']) → List - The latestFirst methods allow you to easily order results by id in descending order and get first record. By default, the result will be ordered by the table's id column. Or, you may pass the column name that you wish to sort by:
-
notOnly(
List< String> keys) → List - Removes elements from the list which is given
-
oldest(
[String key = 'id']) → List - The oldest methods allow you to easily order results by id. By default, the result will be ordered by the table's id column. Or, you may pass the column name that you wish to sort by:
-
oldestFirst(
[String key = 'id']) → List - The oldestFirst methods allow you to easily order results by id and get first record. By default, the result will be ordered by the table's id column. Or, you may pass the column name that you wish to sort by:
-
only(
List< String> keys) → List - Gets only those values which is given
-
pluck(
String? key) → List - The pluck method retrieves all of the values for a given key
-
sortBy(
String key, [bool isDesc = false]) → List - The sortBy method sorts the list of objects by the given key.
-
sortByDesc(
String key) → List - The sortBy method sorts the list of objects by the given key.
-
sorted(
[bool isDesc = false]) → List - Get sorted list
-
sortedDesc(
) → List - Get sorted list
-
whereBetween(
String key, num start, num end) → List - Filters the collection by determining if a specified item value is within a given range
-
whereIn(
String key, List< num> params) → List - Removes elements from the list that do not have a specified item value
-
whereNotBetween(
String key, num start, num end) → List - Filters the collection by determining if a specified item value is outside of a given range
-
whereNotIn(
String key, List< num> params) → List - Removes elements from the list that have a specified item value
-
whereNotNull(
String key) → List - returns items from the collection where the given key is not null
-
whereNull(
String key) → List - returns items from the collection where the given key is null: