countWords method

int countWords()

Return number of words ina given String

Implementation

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