flutter_tim_plugin 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • new51

flutter tim #

基于腾讯云im 封装的一个 flutter im库.所有消息类型都封装了对应的实体类,可以很方便的调用省去自己解析消息。 实体类的属性名完全按照官方文档定义 有不清楚的查看官方文档即可.

联系方式 #

qq群: 290611780 #

前期准备 #

腾讯im官网 申请开发者账号 并创建应用

通过管理后台 获取到密匙和SDKAppID

依赖 IM Flutter plugin #

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

dependencies:
  flutter:
    sdk: flutter

   flutter_tim_plugin: ^0.0.2

然后在项目路径执行 flutter packages get 来下载 Flutter Plugin

集成步骤 #

1.初始化 SDK #

TimFlutterPlugin.init(RongAppKey);

2.获取密匙sig #

官方推荐密匙通过服务器获取防止泄露.

本地可以通过TimFlutterPlugin.getUserSig函数获取封装好的密匙

3. 登录im #

 TimFlutterPlugin.login("userid", "密匙sig")

API 调用 #

发送消息 #

发送文本消息

 Message msg=await TimFlutterPlugin.sendMessage( id: 2255,conversationType: TIMConversationType.C2C,content: TextMessage.obtain("要发送的文本消息"));

  }

发送图片消息

TimFlutterPlugin.sendMessage( id: 2255,conversationType: TIMConversationType.C2C,content: ImageMessage.obtain(path))

发送音视频 、自定义等消息消息

CustomMessage、VideoMessage、SoundMessage

获取漫游和本地消息

 TimFlutterPlugin.getLocalMessage(conversationType: TIMConversationType.C2C, id: 2255, count: 5);
 获取漫游使用getMessage

音视频 图片 文件 下载

downloadFile、downloadVideo

已有的功能 #

  1. 初始化
  2. 登录
  3. 登出
  4. 获取会话列表
  5. 删除一个会话
  6. 获取漫游和本地消息
  7. 发送图片消息
  8. 发送文本消息
  9. 发送地理位置消息
  10. 发送音频消息
  11. 发送视频消息
  12. 发送小文件消息
  13. 发送自定义消息
  14. 设置消息已读上报
  15. 回撤消息
  16. 创建群组
  17. 邀请入群
  18. 申请入群
  19. 获取用户资料
  20. 设置用户资料
  21. 监听新消息回调
  22. 监听用户状态回调

有需要新的api需求或者bug 可到群里联系我 有时间 我会添加和修复 #

0.0.1 #

  • 发布第一版

0.0.3 #

  • 优化代码

0.0.4 #

  • 去除无用的错误码类

0.0.5 #

  • 修改英文描述文件

example/README.md

flutter_tim_plugin_example #

Demonstrates how to use the flutter_tim_plugin plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_tim_plugin: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_tim_plugin/common_define.dart';
import 'package:flutter_tim_plugin/message/conversation.dart';
import 'package:flutter_tim_plugin/message/custom_message.dart';
import 'package:flutter_tim_plugin/message/emoji_message.dart';
import 'package:flutter_tim_plugin/message/file_message.dart';
import 'package:flutter_tim_plugin/message/image_message.dart';
import 'package:flutter_tim_plugin/message/location_message.dart';
import 'package:flutter_tim_plugin/message/message.dart';
import 'package:flutter_tim_plugin/message/message_content.dart';
import 'package:flutter_tim_plugin/message/message_factory.dart';
import 'package:flutter_tim_plugin/message/sound_message.dart';
import 'package:flutter_tim_plugin/message/text_message.dart';
import 'package:flutter_tim_plugin/message/video_message.dart';
import 'package:flutter_tim_plugin/tim_flutter_plugin.dart';
import 'package:flutter_tim_plugin/tim_method_key.dart';
import 'package:flutter_tim_plugin/util/type_util.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
51
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health issues and suggestions

Document public APIs. (-0.11 points)

411 out of 424 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/tim_flutter_plugin.dart. (-0.50 points)

Analysis of lib/tim_flutter_plugin.dart reported 1 hint:

line 132 col 52: Avoid using braces in interpolation when not needed.

Format lib/common_define.dart.

Run flutter format to format lib/common_define.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test