countWords method

int countWords()

Return number of words ina given String

Implementation

int countWords() {
  var words = validate().trim().split(RegExp(r'(\s+)'));
  return words.length;
}