downloadMedia method

Future<Map<String, dynamic>?> downloadMedia({
  1. required MessageId messageId,
})

Download the base64 of a media message

Implementation

Future<Map<String, dynamic>?> downloadMedia({
  required MessageId messageId,
}) async {
  String mediaSerialized = messageId.serialized;
  String? base64 = await wpClient.evaluateJs(
    '''WPP.chat.downloadMedia(${mediaSerialized.jsParse}).then(WPP.util.blobToBase64);''',
    methodName: "downloadMedia",
  );
  if (base64 == null) return null;
  return base64ToMap(base64);
}