createMessage method
Future
createMessage(
- {required JMMessageType? type,
- required dynamic targetType,
- String? text,
- String? path,
- String? fileName,
- Map? customObject,
- double? latitude,
- double? longitude,
- int? scale,
- String? address,
)
Implementation
Future<dynamic> createMessage({
required JMMessageType? type, // 消息类型
required dynamic targetType,
/// (JMSingle | JMGroup | JMChatRoom)
String? text,
String? path,
String? fileName,
Map<dynamic, dynamic>? customObject,
double? latitude,
double? longitude,
int? scale,
String? address,
Map<dynamic, dynamic>? extras,
}) async {
Map param = targetType.toJson();
if (extras != null) {
param..addAll({'extras': extras});
}
param
..addAll({
'messageType': getStringFromEnum(type),
'text': text,
'path': path,
'fileName': fileName,
'customObject': customObject,
'latitude': latitude,
'longitude': longitude,
'scale': scale,
'address': address,
});
Map resMap = await _channel.invokeMethod(
'createMessage', param..removeWhere((key, value) => value == null));
var res = JMNormalMessage.generateMessageFromJson(resMap);
return res;
}