lengthCategories property

Map<String, int> get lengthCategories

Get surahs by length category

Implementation

Map<String, int> get lengthCategories {
  int veryShort = 0; // 1-10 ayat
  int short = 0; // 11-50 ayat
  int medium = 0; // 51-100 ayat
  int long = 0; // 101-200 ayat
  int veryLong = 0; // 200+ ayat

  distribution.forEach((ayatCount, surahCount) {
    if (ayatCount <= 10) {
      veryShort += surahCount;
    } else if (ayatCount <= 50) {
      short += surahCount;
    } else if (ayatCount <= 100) {
      medium += surahCount;
    } else if (ayatCount <= 200) {
      long += surahCount;
    } else {
      veryLong += surahCount;
    }
  });

  return {
    'veryShort': veryShort,
    'short': short,
    'medium': medium,
    'long': long,
    'veryLong': veryLong,
  };
}