getTokens function

int getTokens(
  1. String text
)

Implementation

int getTokens(String text) {
  // A simple implementation that approximates token count
  // You may want to use a more sophisticated tokenizer in production
  return text.split(RegExp(r'\s+')).length;
}