count method of string in dart code example Example: dart count words in string return str.split(' ').length;