groupByFirstLetter function

Map<String, List<String>> groupByFirstLetter(
  1. List<String> words
)

Implementation

Map<String, List<String>> groupByFirstLetter(List<String> words) {
  final filteredWords = words.where((w) => w.isNotEmpty).toList();

  return groupByKey<String, String>(
    filteredWords,
    (word) => word[0].toUpperCase(),
  );
}