toMap method

Map<String, dynamic>? toMap()

Implementation

Map<String, dynamic>? toMap() {
  if (value.containsKey('text') && value['text'] == null) return null;

  var ret = <String, dynamic>{};
  ret.addAll(value);
  if (color != null) ret['color'] = color.toString();
  if (bold != null) ret['bold'] = bold;
  if (italic != null) ret['italic'] = italic;
  if (underlined != null) ret['underlined'] = underlined;
  if (strikethrough != null) ret['strikethrough'] = strikethrough;
  if (obfuscated != null) ret['obfuscated'] = obfuscated;
  if (clickEvent != null) ret['clickEvent'] = clickEvent?.toMap();
  if (hoverEvent != null) ret['hoverEvent'] = hoverEvent?.toMap();
  if (insertion != null) ret['insertion'] = insertion;
  return ret;
}