# toDocument method Null safety

1. @override

Map<String, Object?> toDocument()
override

## Implementation

    @override
    Map<String, Object?> toDocument() {
      final Map<String, dynamic>? actionMap =
          action != null ? action!.toDocument() : null;
      final Map<String, dynamic>? posSizeMap =
          posSize != null ? posSize!.toDocument() : null;

      Map<String, Object?> theDocument = HashMap();
      if (description != null) {
        theDocument["description"] = description;
      } else {
        theDocument["description"] = null;
      }
      if (action != null) {
        theDocument["action"] = actionMap;
      } else {
        theDocument["action"] = null;
      }
      if (imageId != null) {
        theDocument["imageId"] = imageId;
      } else {
        theDocument["imageId"] = null;
      }
      if (posSize != null) {
        theDocument["posSize"] = posSizeMap;
      } else {
        theDocument["posSize"] = null;
      }
      return theDocument;
    }