sendImageMessage method

Future<JMImageMessage> sendImageMessage ({@required dynamic type, @required String path, JMMessageSendOptions sendOption, Map extras })

Implementation

Future<JMImageMessage> sendImageMessage({
  @required dynamic type, /// (JMSingle | JMGroup | JMChatRoom)
  @required String path,
  JMMessageSendOptions sendOption,
  Map<dynamic, dynamic> extras,
}) async {
  Map param = type.toJson();

  Map optionMap = {};
  if (sendOption != null) {
      optionMap = {'messageSendingOptions': sendOption.toJson()..removeWhere((key,value) => value == null)};
  }

  if (extras != null) {
    param..addAll({'extras': extras});
  }

  param..addAll(optionMap)..addAll({'path': path});

  Map resMap = await _channel.invokeMethod('sendImageMessage',
    param..removeWhere((key,value) => value == null));
  var res = JMNormalMessage.generateMessageFromJson(resMap);
  return res;
}