tokenizeSentences function
Splits text into sentences (split on . ! ? followed by space or end).
Implementation
List<String> tokenizeSentences(String text) {
if (text.trim().isEmpty) return <String>[];
return text
.split(RegExp(r'(?<=[.!?])\s+'))
.map((String s) => s.trim())
.where((String s) => s.isNotEmpty)
.toList();
}