calcLocalizedBody method
Returns a localized String representation of this event. For a
room list you may find withSenderNamePrefix
useful. Set hideReply
to
crop all lines starting with '>'. With plaintextBody
it'll use the
plaintextBody instead of the normal body.
removeMarkdown
allow to remove the markdown formating from the event body.
Usefull form message preview or notifications text.
Implementation
Future<String> calcLocalizedBody(SDNLocalizations i18n,
{bool withSenderNamePrefix = false,
bool hideReply = false,
bool hideEdit = false,
bool plaintextBody = false,
bool removeMarkdown = false}) async {
if (redacted) {
await redactedBecause?.fetchSenderUser();
}
if (withSenderNamePrefix &&
(type == EventTypes.Message || type.contains(EventTypes.Encrypted))) {
// To be sure that if the event need to be localized, the user is in memory.
// used by EventLocalizations._localizedBodyNormalMessage
await fetchSenderUser();
}
return calcLocalizedBodyFallback(i18n,
withSenderNamePrefix: withSenderNamePrefix,
hideReply: hideReply,
hideEdit: hideEdit,
plaintextBody: plaintextBody,
removeMarkdown: removeMarkdown);
}