toJson method

Object toJson()

Converts the EmbedBuilder to a Map that can be serialized to JSON.

Implementation

Object toJson () {
  List<dynamic> fields = [];
  if (this.fields != null) {
    for (final field in this.fields!) {
      fields.add(field.toJson());
    }
  }

  return {
    'title': title,
    'description': description,
    'url': url,
    'footer': footer?.toJson(),
    'timestamp': timestamp?.toIso8601String(),
    'fields': fields,
    'color': color != null
      ? int.parse(color.toString().replaceAll('#', ''), radix: 16)
      : null,
    'image': image?.toJson(),
    'thumbnail': thumbnail?.toJson(),
    'author': author?.toJson(),
  };
}