mdTextCompiler function
String
mdTextCompiler(
- String originalText, {
- bool isUseTencentCloudChatPackage = false,
- List<
CustomEmojiFaceData> customEmojiStickerList = const [],
Implementation
String mdTextCompiler(String originalText, {
bool isUseTencentCloudChatPackage = false,
List<CustomEmojiFaceData> customEmojiStickerList = const [],
}) {
String text = originalText;
final EmojiUtil emojiUtil = EmojiUtil(
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
customEmojiStickerList: customEmojiStickerList);
text = text.replaceAllMapped(emojiExp, (match) {
String key = match.group(0)!;
// Check if the emoji exists in the emoji map
if (emojiUtil.emojiMap.containsKey(key)) {
String assetPath = emojiUtil.emojiMap[key]!;
return '![sticker](resource:$assetPath#22x22)';
}
return key;
});
return text;
}