mostWords function

List<Map<String, int>> mostWords(
  1. String text
)

Implementation

List<Map<String, int>> mostWords(String text) {
  final list = wordsRepetition(text, sorted: true, order: Order.descending);
  int max = 0;
  List<Map<String, int>> result = [];
  for (var word in list.entries) {
    if (word.value >= max) {
      result.add({word.key: word.value});
      max = word.value;
    }
  }
  return result;
}