toDocument method

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

Implementation

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

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