formatMessagePreview static method
Formats a message for preview (truncates long messages)
Implementation
static String formatMessagePreview(String message, {int maxLength = 30}) {
if (message.isEmpty) {
return "No message";
}
// Replace newlines with spaces for cleaner preview
String cleanMessage = message.replaceAll('\n', ' ');
if (cleanMessage.length <= maxLength) {
return cleanMessage;
}
return '${cleanMessage.substring(0, maxLength)}...';
}