tokenizeWords function

List<String> tokenizeWords(
  1. String text
)

Splits text into words (non-empty runs of letters/numbers).

Implementation

List<String> tokenizeWords(String text) => text
    .split(RegExp(r'\s+'))
    .map((String s) => s.replaceAll(RegExp(r'[^\w]'), '').trim())
    .where((String s) => s.isNotEmpty)
    .toList();