count static method

int count(
  1. String word
)

Implementation

static int count(String word) {
  word = word.toLowerCase();

  final vowels = RegExp(r'[aeiouy]+');
  final matches = vowels.allMatches(word);

  return matches.isEmpty ? 1 : matches.length;
}