toMap property Null safety

Map toMap

Convert SMS to map

Implementation

Map get toMap {
  Map data = {};
  if (address != null) {
    data["address"] = address;
  }
  if (body != null) {
    data["body"] = body;
  }
  if (id != null) {
    data["_id"] = id;
  }
  if (threadId != null) {
    data["thread_id"] = threadId;
  }
  if (read != null) {
    data["read"] = read;
  }
  if (date != null) {
    data["date"] = date!.millisecondsSinceEpoch;
  }
  if (dateSent != null) {
    data["dateSent"] = dateSent!.millisecondsSinceEpoch;
  }
  return data;
}