mapToList<V> method

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

Returns a list picked from map using keys in the keys order.

Use this when constructing TabBar and TabBarView widgets when having a map of widgets.

Implementation

List<V> mapToList<V>(Map<K, V> map) {
  final result = <V>[];

  for (final key in keys) {
    result.add(map[key] ?? (throw Exception('Item not found by key: $key')));
  }

  return result;
}