tryParse static method

MessageStatus? tryParse(
  1. String? value
)

Implementation

static MessageStatus? tryParse(String? value) {
  final status = value?.trim().toLowerCase();
  if (status?.isEmpty ?? true) return null;
  if (status == read.name) {
    return read;
  } else if (status == delivered.name) {
    return delivered;
  } else if (status == undelivered.name) {
    return undelivered;
  } else if (status == pending.name) {
    return pending;
  }
  return null;
}