tryParse static method
Implementation
static MessageType? tryParse(String? value) {
final type = value?.trim().toLowerCase();
if (type?.isEmpty ?? true) return null;
if (type == image.name) {
return image;
} else if (type == text.name) {
return text;
} else if (type == voice.name) {
return voice;
} else if (type == custom.name) {
return custom;
}
return null;
}