downloadFile method Null safety

Future<Map> downloadFile(
  1. {required dynamic target,
  2. required String? messageId}
)

下载文件 target 聊天对象, JMSingle | JMGroup | JMChatRoom messageId 本地数据库中的消息 id

Implementation

Future<Map> downloadFile({
  required dynamic target,
  required String? messageId,
}) async {
  Map param = target.toJson();
  param['messageId'] = messageId;
  Map resJson = await _channel.invokeMethod(
      'downloadFile', param..removeWhere((key, value) => value == null));

  return {'messageId': resJson['messageId'], 'filePath': resJson['filePath']};
}