融云 IMLib 是即时通讯核心 SDK,支持单聊、群聊、聊天室、系统通知、超级群等功能。通过集成 IM Wrapper Plugin,您可以在 Flutter 应用中快速实现完整的即时通讯功能。
- 如果您还没有融云开发者账号,在融云控制台注册一个。
- 在控制台,通过应用配置>基本信息>App Key,获取您的 App Key。
- 通过服务端 API,获取用户 Token。
App Secret 用于生成数据签名,仅在请求融云服务端 API 接口时使用。
在项目的 pubspec.yaml
中写如下依赖:
dependencies:
flutter:
sdk: flutter
rongcloud_im_wrapper_plugin: 5.24.5
详细的集成步骤、API 使用说明、功能配置等内容,请参考 融云 IMLib Flutter 完整开发文档。
文档包含以下完整内容:
- 初始化 - SDK 初始化和引擎创建
- 连接与断开 - 建立和断开 IM 连接
- 消息管理 - 发送、接收、存储消息
- 会话管理 - 会话列表和会话操作
- 群组管理 - 群组创建、管理和操作
- 聊天室管理 - 聊天室加入和管理
- 推送服务 - 离线推送配置
- 完整的 API 参考和错误码说明
// 导入 SDK
import 'package:rongcloud_im_wrapper_plugin/rongcloud_im_wrapper_plugin.dart';
// 初始化 SDK
RCIMIWEngineOptions options = RCIMIWEngineOptions.create();
RCIMIWEngine engine = await RCIMIWEngine.create(appkey, options);
// 连接 IM 服务
engine.connect(token, timeout);
engine.onConnected = (int? code, String? userId) {
if (code == 0) {
// 连接成功
}
};
// 发送文本消息
RCIMIWTextMessage? textMessage = await engine.createTextMessage(
conversationType, targetId, channelId, text,
);
engine.sendMessage(textMessage);
// 监听接收消息
engine.onMessageReceived = (
RCIMIWMessage? message,
int? left,
bool? offline,
bool? hasPackage,
) {
// 处理接收到的消息
};
如有任何问题,请通过以下方式获取帮助:
RC IMLib is the core instant messaging SDK, supporting private chat, group chat, chatroom, system notifications, ultra groups, and more. By integrating the IM Wrapper Plugin, you can quickly implement complete instant messaging functionality in your Flutter applications.
RC Android IMLib Documentation
- If you don't have a RC developer account yet, register one at RongCloud Console.
- In the console, get your App Key through Application Configuration > Basic Information > App Key.
- Get user Token through server-side API, register user.
App Secret is used to generate data signatures and is only required when calling RC's server API.
Add the following dependencies to your project's pubspec.yaml
:
dependencies:
flutter:
sdk: flutter
rongcloud_im_wrapper_plugin: 5.24.5
For detailed integration steps, API usage instructions, feature configurations, and more, please refer to RC IMLib Flutter Complete Development Documentation.
The documentation includes comprehensive content on:
- Initialization - SDK initialization and engine creation
- Connect & Disconnect - Establish and disconnect IM connections
- Message Management - Send, receive, and store messages
- Conversation Management - Conversation lists and operations
- Group Management - Group creation, management, and operations
- Chatroom Management - Join and manage chatrooms
- Push Service - Offline push configuration
- Complete API reference and error code explanations
// Import SDK
import 'package:rongcloud_im_wrapper_plugin/rongcloud_im_wrapper_plugin.dart';
// Initialize SDK
RCIMIWEngineOptions options = RCIMIWEngineOptions.create();
RCIMIWEngine engine = await RCIMIWEngine.create(appkey, options);
// Connect to IM service
engine.connect(token, timeout);
engine.onConnected = (int? code, String? userId) {
if (code == 0) {
// Connection successful
}
};
// Send text message
RCIMIWTextMessage? textMessage = await engine.createTextMessage(
conversationType, targetId, channelId, text,
);
engine.sendMessage(textMessage);
// Listen for received messages
engine.onMessageReceived = (
RCIMIWMessage? message,
int? left,
bool? offline,
bool? hasPackage,
) {
// Handle received message
};
For any questions, please get help through:
- Consult the Official Complete Documentation
- Submit a ticket to contact RC technical support