String sanitizeValue(String? text) { text ??= ''; if (text.length > _maxLength) { // Slice to max length. text = text.substring(0, _maxLength); } return text; }