mostChars function

List<Map<String, int>> mostChars(
  1. String text, {
  2. bool ignoreSpace = true,
})

Implementation

List<Map<String, int>> mostChars(String text, {bool ignoreSpace = true}) {
  final list = charsRepetition(text,
      sorted: true, order: Order.descending, ignoreSpace: ignoreSpace);
  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;
}