toDocument method

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

Implementation

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

  Map<String, Object?> theDocument = HashMap();
  if (postId != null) {
    theDocument["postId"] = postId;
  } else {
    theDocument["postId"] = null;
  }
  if (postCommentId != null) {
    theDocument["postCommentId"] = postCommentId;
  } else {
    theDocument["postCommentId"] = null;
  }
  if (memberId != null) {
    theDocument["memberId"] = memberId;
  } else {
    theDocument["memberId"] = null;
  }
  theDocument["timestamp"] = timestamp;
  if (appId != null) {
    theDocument["appId"] = appId;
  } else {
    theDocument["appId"] = null;
  }
  if (comment != null) {
    theDocument["comment"] = comment;
  } else {
    theDocument["comment"] = null;
  }
  if (likes != null) {
    theDocument["likes"] = likes;
  } else {
    theDocument["likes"] = null;
  }
  if (dislikes != null) {
    theDocument["dislikes"] = dislikes;
  } else {
    theDocument["dislikes"] = null;
  }
  if (memberMedia != null) {
    theDocument["memberMedia"] = memberMediaListMap;
  } else {
    theDocument["memberMedia"] = null;
  }
  return theDocument;
}