旧版 SDK (rongcloud_im_plugin
) 判断消息类型的方式如下:
switch (msg.objectName) {
case "RC: CmdMsg":
//...
break;
case "RC: TxtMsg":
//...
break;
}
Flutter IMLib 5.X 新版 SDK(rongcloud_im_wrapper_plugin)的消息提供了 messageType 属性,可用于消息类型的判断。可参考下面代码:
switch (message.messageType) {
case RCIMIWMessageType.text:
//....
break;
case RCIMIWMessageType.voice:
//....
break;
case RCIMIWMessageType.userCustom:
//....
break;
}