validateTextContent static method
Validates text message content.
text is the text content to validate.
Returns true if the text is valid.
Throws MessageException if the text is invalid.
Implementation
static bool validateTextContent(String text) {
if (text.isEmpty) {
throw MessageException.invalidContent('Message text cannot be empty.');
}
if (text.length > 4096) {
throw MessageException.invalidContent(
'Message text exceeds maximum length of 4096 characters.',
);
}
return true;
}