pluck<K, V> static method

List<V?> pluck<K, V>(
  1. Iterable<Map<K, V>> list,
  2. K key
)

Plucks the value at key from each map in list.

Arr.pluck([
  {'name': 'Anna'},
  {'name': 'Brad'},
], 'name'); // ['Anna', 'Brad']

Implementation

static List<V?> pluck<K, V>(Iterable<Map<K, V>> list, K key) => [
  for (final m in list) m[key],
];