Skip to content

rongcloud/im-flutter-wrapper

Repository files navigation

融云 Flutter IMLib

融云 IMLib 是即时通讯核心 SDK,支持单聊、群聊、聊天室、系统通知、超级群等功能。通过集成 IM Wrapper Plugin,您可以在 Flutter 应用中快速实现完整的即时通讯功能。

融云 iOS IMLib 文档

融云 Android IMLib 文档

准备工作

  1. 如果您还没有融云开发者账号,在融云控制台注册一个。
  2. 在控制台,通过应用配置>基本信息>App Key,获取您的 App Key。
  3. 通过服务端 API,获取用户 Token

App Secret 用于生成数据签名,仅在请求融云服务端 API 接口时使用。

依赖 IM Wrapper Plugin

在项目的 pubspec.yaml 中写如下依赖:

dependencies:
  flutter:
    sdk: flutter
  rongcloud_im_wrapper_plugin: 5.24.5

快速开始

详细的集成步骤、API 使用说明、功能配置等内容,请参考 融云 IMLib Flutter 完整开发文档

文档包含以下完整内容:

基本使用示例

1. 初始化和连接

// 导入 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);

2. 监听连接状态

engine.onConnected = (int? code, String? userId) {
  if (code == 0) {
    // 连接成功
  }
};

3. 发送和接收消息

// 发送文本消息
RCIMIWTextMessage? textMessage = await engine.createTextMessage(
  conversationType, targetId, channelId, text,
);
engine.sendMessage(textMessage);

// 监听接收消息
engine.onMessageReceived = (
  RCIMIWMessage? message,
  int? left,
  bool? offline,
  bool? hasPackage,
) {
  // 处理接收到的消息
};

支持

如有任何问题,请通过以下方式获取帮助:


Introducing RC IMLib for Flutter

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 iOS IMLib Documentation

RC Android IMLib Documentation

Preparations

  1. If you don't have a RC developer account yet, register one at RongCloud Console.
  2. In the console, get your App Key through Application Configuration > Basic Information > App Key.
  3. 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.

Dependencies on IM Wrapper Plugin

Add the following dependencies to your project's pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  rongcloud_im_wrapper_plugin: 5.24.5

Quick Start

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:

Basic Usage Examples

1. Initialize and Connect

// 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);

2. Listen for Connection Status

engine.onConnected = (int? code, String? userId) {
  if (code == 0) {
    // Connection successful
  }
};

3. Send and Receive Messages

// 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
};

Support

For any questions, please get help through:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •