SmsMessage.fromJson constructor Null safety

SmsMessage.fromJson(
  1. Map data
)

Implementation

SmsMessage.fromJson(Map data) {
  address = data["address"];
  body = data["body"];
  if (data.containsKey("_id")) {
    id = data["_id"];
  }
  if (data.containsKey("thread_id")) {
    threadId = data["thread_id"];
  }
  if (data.containsKey("read")) {
    read = (data["read"].toInt() == 1);
  }
  if (data.containsKey("kind")) {
    kind = data["kind"];
  }
  if (data.containsKey("date")) {
    date = DateTime.fromMillisecondsSinceEpoch(data["date"]);
  }
  if (data.containsKey("date_sent")) {
    dateSent = DateTime.fromMillisecondsSinceEpoch(data["date_sent"]);
  }
}