# toDocument method Null safety

1. @override

Map<String, Object?> toDocument()
override

## Implementation

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

      Map<String, Object?> theDocument = HashMap();
      if (title != null) {
        theDocument["title"] = title;
      } else {
        theDocument["title"] = null;
      }
      if (description != null) {
        theDocument["description"] = description;
      } else {
        theDocument["description"] = null;
      }
      if (imageId != null) {
        theDocument["imageId"] = imageId;
      } else {
        theDocument["imageId"] = null;
      }
      if (imagePositionRelative != null) {
        theDocument["imagePositionRelative"] = imagePositionRelative;
      } else {
        theDocument["imagePositionRelative"] = null;
      }
      if (imageAlignment != null) {
        theDocument["imageAlignment"] = imageAlignment;
      } else {
        theDocument["imageAlignment"] = null;
      }
      if (imageWidth != null) {
        theDocument["imageWidth"] = imageWidth;
      } else {
        theDocument["imageWidth"] = null;
      }
      if (links != null) {
        theDocument["links"] = linksListMap;
      } else {
        theDocument["links"] = null;
      }
      return theDocument;
    }