sy_im library

SY IM Flutter SDK

与 RTC 相同的 AppID 模型:SyIm.create(appId, apiBaseUrl)。 唯一实时路径:Dart OpenIMAdapter → 官方 flutter_openim_sdk / OpenIM.iMManager。 无遗留 SyImFlutterSdkPlugin MethodChannel。 IM Token / imApiAddr / imWsAddr 由开发者后端签发(/api/server/im/token 或用户态等价接口)。

Classes

ImControlPlane
SY IM 控制面 REST(非 OpenIM 原生 SDK)。
OpenIMAdapter
OpenIM → SyIm 适配层(唯一实时路径)。真实调用 OpenIM.iMManager。
SyIm
全局入口,对齐 RTC SyRtcEngine.create。
SyImBlacklistUser
SyImConversation
SyImEngine
SyImErrorCode
SY 控制面(/api/user/im/*、/api/server/im/token)返回的业务码。
SyImFriend
SyImFriendApplication
好友申请。handleResult:0 未处理,1 已同意,-1 已拒绝。
SyImGroup
SyImGroupMember
SyImGroupReadChange
Group read-receipt event for Flutter.
SyImGroupReadInfo
群消息已读概况,三端相同。flutter_openim_sdk 3.8.3+hotfix.15 的 GroupHasReadInfo 只有人数, 已读成员来自控制面 who-read 花名册(source == controlPlane),否则为空(none)。 花名册只含调用过 reportGroupMessagesRead 的成员,不是全员已读名单。
SyImGroupReadTracker
Pure diff logic: the first observation of a message is the baseline (no event), afterwards an event fires when the read count grows or new readers appear.
SyImGroupReadWatch
Watches some messages of one group conversation. Create it with SyImEngine.watchGroupReadReceipts; call cancel when the screen goes away.
SyImReaction
表情回应(lite)。服务端 POST /api/user/im/reaction 发出的 Custom(110) 消息,data 为 {"sy":"reaction_lite","action":"add|remove","emoji":"👍","target":{"seq":..,"clientMsgId":..,"senderId":..}}。 与 Android ImReaction、iOS SyImReaction 解析规则相同。
SyImReadReceipt
已读回执(单聊 + 群聊统一)。与 Android ImReadReceipt、iOS SyImReadReceipt 字段和语义相同:
SyImReadReceipts
已读回执的纯逻辑,三端规则相同(Android ImReadReceipts、iOS SyImReadReceipts)。
SyImRecvOpt
会话免打扰。0 正常,1 不接收,2 仅在线接收。
SyImRevokedMessage
SyImSearchHit
SyImTypingStatus
对方输入状态。字段与 Android ImTypingStatus、iOS SyImTypingStatus 相同。
SyImUnreadHub
把 OpenIM 的总未读、会话变更和本地标已读收成同一次快照。
SyImUnreadUpdate
未读变化。totalUnread 是全部会话未读总数,conversations 是当前缓存的会话列表。
SyImUserProfile

Constants

syImAtAllUserId → const String
@所有人 时放进 SyImEngine.sendAtTextMessage 的 atUserIds。
syImSdkVersion → const String
与 Android / iOS IM SDK 对齐的版本号。

Functions

decodeControlPlaneResponse(int httpStatus, String body) → Map<String, dynamic>
解析控制面响应。非 2xx 或业务码非 0 时抛 SyImControlPlaneException。
mergeConversations(List<SyImConversation> current, List<SyImConversation> incoming) → List<SyImConversation>
sumUnread(List<SyImConversation> conversations) → int

Typedefs

SyImGroupReadFetch = Future<SyImGroupReadInfo> Function(String conversationId, String clientMsgId)
SyImGroupReadReceiptCallback = void Function(String conversationId, String? groupId, List<String> msgIds)
Callback with the same meaning as Android onRecvGroupReadReceipt(conversationId) and iOS onRecvGroupReadReceipt(groupId, msgIds).

Exceptions / Errors

SyImControlPlaneException
控制面请求失败。code 为响应体业务码(见 SyImErrorCode),响应体没有 code 时为 HTTP 状态码。 仍是 Exception,已有的 on Exception 可以接住。