fromMap<K, V> static method

List<DraftModeListItem<K, V>> fromMap<K, V>(
  1. Map<K, V> map
)

Maps a Map's entries to DraftModeListItems while preserving insertion order. Handy when the data already lives in a keyed cache.

Implementation

static List<DraftModeListItem<K, V>> fromMap<K, V>(Map<K, V> map) {
  return map.entries
      .map(
        (entry) => DraftModeListItem<K, V>(
          id: entry.key,
          value: entry.value,
        ),
      )
      .toList();
}