countWords method

int countWords()

Returns the number of words in the string.

Implementation

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