# 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;

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