int countCharacterFrequency(String input, String char)

Source

int countCharacterFrequency(String input, String char) {
  var c = char.codeUnitAt(0);

  return input.codeUnits.where((u) => c == u).length;
}