build method
Builds object to Map() instance;
Implementation
@override
/// Builds object to Map() instance;
RawApiMap build() {
if (this.title != null && this.title!.length > 256) {
throw EmbedBuilderArgumentException._new("Embed title is too long (256 characters limit)");
}
if (this.description != null && this.description!.length > 2048) {
throw EmbedBuilderArgumentException._new("Embed description is too long (2048 characters limit)");
}
if (this.fields.length > 25) {
throw EmbedBuilderArgumentException._new("Embed cannot contain more than 25 fields");
}
if (this.length > 6000) {
throw EmbedBuilderArgumentException._new("Total length of embed cannot exceed 6000 characters");
}
return <String, dynamic>{
if (title != null) "title": title,
if (type != null) "type": type,
if (description != null) "description": description,
if (url != null) "url": url,
if (timestamp != null) "timestamp": timestamp!.toUtc().toIso8601String(),
if (color != null) "color": color!._value,
if (footer != null) "footer": footer!.build(),
if (imageUrl != null) "image": <String, dynamic>{"url": imageUrl},
if (thumbnailUrl != null) "thumbnail": <String, dynamic>{"url": thumbnailUrl},
if (author != null) "author": author!.build(),
if (fields.isNotEmpty) "fields": fields.map((builder) => builder.build()).toList()
};
}