sendGroupTextMessage method
Implementation
Future<dynamic> sendGroupTextMessage(Map<String, dynamic> params) async {
try {
final textParams = CreateMessage.createTextMessage(
userID: params['groupID'],
text: params['text'],
convType: 'GROUP',
priority: params['priority']);
final textMessage = V2TIMManagerWeb.timWeb!.createTextMessage(textParams);
final res = await wrappedPromiseToFuture(
V2TIMManagerWeb.timWeb!.sendMessage(textMessage));
final code = res.code;
if (code == 0) {
final message = jsToMap(res.data)["message"];
final formatedMessage =
await V2TIMMessage.convertMessageFromWebToDart(message);
return CommonUtils.returnSuccess<V2TimMessage>(formatedMessage);
} else {
return CommonUtils.returnErrorForValueCb<V2TimMessage>('发送群文本消息失败');
}
} catch (error) {
return CommonUtils.returnErrorForValueCb<V2TimMessage>(error.toString());
}
}