tryParse static method

MessageType? tryParse(
  1. String? value
)

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;
}