toDocument method

  1. @override
Map<String, Object?> toDocument()
override

Implementation

@override
Map<String, Object?> toDocument() {
  final List<Map<String?, dynamic>>? chatMediaListMap = chatMedia != null
      ? chatMedia!.map((item) => item.toDocument()).toList()
      : null;

  Map<String, Object?> theDocument = HashMap();
  if (authorId != null) {
    theDocument["authorId"] = authorId;
  } else {
    theDocument["authorId"] = null;
  }
  if (appId != null) {
    theDocument["appId"] = appId;
  } else {
    theDocument["appId"] = null;
  }
  if (roomId != null) {
    theDocument["roomId"] = roomId;
  } else {
    theDocument["roomId"] = null;
  }
  theDocument["timestamp"] = timestamp;
  if (saying != null) {
    theDocument["saying"] = saying;
  } else {
    theDocument["saying"] = null;
  }
  if (accessibleByGroup != null) {
    theDocument["accessibleByGroup"] = accessibleByGroup;
  } else {
    theDocument["accessibleByGroup"] = null;
  }
  if (accessibleByMembers != null) {
    theDocument["accessibleByMembers"] = accessibleByMembers!.toList();
  } else {
    theDocument["accessibleByMembers"] = null;
  }
  if (readAccess != null) {
    theDocument["readAccess"] = readAccess!.toList();
  } else {
    theDocument["readAccess"] = null;
  }
  if (chatMedia != null) {
    theDocument["chatMedia"] = chatMediaListMap;
  } else {
    theDocument["chatMedia"] = null;
  }
  return theDocument;
}