Returns the word count of value.
value
static int wordCount(String value) { final trimmed = value.trim(); if (trimmed.isEmpty) return 0; return trimmed.split(RegExp(r'\s+')).length; }