wordCount function

int wordCount(
  1. String text
)

Implementation

int wordCount(String text) {
  final words = text.split(RegExp(r'[ \n\t]+'));
  return words.where((word) => word.isNotEmpty).length;
}