Basic use case

Online api test tool (scan code to download)

img

Api call use case

GitHub address

  • Initialization
import 'package:tencent_im_sdk_plugin/tencent_im_sdk_plugin.dart';
import 'package:tencent_im_sdk_plugin/models/v2_tim_value_callback.dart';
import 'package:tencent_im_sdk_plugin/enum/log_level.dart';
import 'package:tencent_im_sdk_plugin/manager/v2_tim_manager.dart';
import 'package:tencent_im_sdk_plugin/models/v2_tim_callback.dart';
function initLisener(data){
  String type = data.type;
  switch(type){
      case: 'onConnecting':
      case: 'onConnectSuccess':
      case: 'onConnectFailed':
      case: 'onKickedOffline':
      case: 'onUserSigExpired':
      case: 'onSelfInfoUpdated':
  }
}
// Get Tencent instant messaging IM manager;
V2TIMManager timManager = TencentImSDKPlugin.v2TIMManager;
// Initialize SDK
V2TimValueCallback<bool> initRes = await timManager.initSDK(
      sdkAppID: sdkAppID,// Fill in the sdkappid applied on the console
      loglevel: LogLevel.V2TIM_LOG_DEBUG,
      listener: initLisener,
);

// All data structures returned by V2TimValueCallback
int code initRes.codeļ¼›
String desc = initRes.desc;
bool data = initRes.data;// Generic type received when instantiating for V2TimValueCallback.

if(initRes.code == 0){
  // Initialization successful
  // The following monitoring can be set as needed. To prevent missing messages, please set monitoring before logging in.
  // simple monitor
  timManager.addSimpleMsgListener(
    listener: simpleMsgListener,
  );
 // Various monitoring can be added here, such as session monitoring, message receiving monitoring, group monitoring, etc.
 V2TimCallback loginRes await timManager.login(
   userID: userId,
   userSig: userSig,
  );
  // All data structures returned by V2TimCallback
  int code  = loginRes.code;
  String desc = loginRes.desc;
  
  if(code==0){
    // login successful
    // send messages
    timManager.sendC2CTextMessage(text:text,userID:userID,)
    //....
    // Any method of the SDK can be called here.
  }else{
    // Login failed
    print(desc);
  }
}else{
  // initialization failed
}

Managers

  • V2TIMManager

    The group advanced interface includes advanced functions of the group, such as group member invitation, non-group member application to join the group and other operation interfaces.

  • V2TIMFriendshipManager

    The relationship chain interface includes logic for adding and deleting friends, and adding and deleting blacklists.

  • V2TIMGroupManager

    The group advanced interface includes advanced functions of the group, such as group member invitation, non-group member application to join the group and other operation interfaces.

  • V2TIMConversationManager

    The session interface contains the logic for acquiring, deleting and updating sessions.

  • V2TIMMessageManager

    Provides advanced message processing related interfaces

  • V2TIMOfflinePushManager

    Provide offline push related interface

  • V2TIMSignalingManager

    Provides interfaces related to signaling operations

Libraries

enum/at_info_types
enum/callbacks
enum/conversation_type
enum/friend_application_type_enum
enum/friend_response_type_enum
enum/friend_type
enum/friend_type_enum
enum/get_group_message_read_member_list_filter
enum/group_add_opt_enum
enum/group_add_opt_type
enum/group_application_handle_result
enum/group_application_handle_status
enum/group_application_type
enum/group_application_type_enum
enum/group_change_info_type
enum/group_member_filter_enum
enum/group_member_filter_type
enum/group_member_role
enum/group_member_role_enum
enum/group_tips_elem_type
enum/group_type
enum/history_message_get_type
enum/history_msg_get_type_enum
enum/image_types
enum/listener_type
enum/log_level
enum/log_level_enum
enum/message_elem_type
enum/message_priority
enum/message_priority_enum
enum/message_status
enum/offlinePushInfo
enum/receive_message_opt_enum
enum/simpleMsgListenerType
enum/user_info_allow_type
enum/utils
enum/v2_tim_keyword_list_match_type
enum/V2TimAdvancedMsgListener
enum/V2TimConversationListener
enum/V2TimFriendshipListener
enum/V2TimGroupListener
enum/V2TIMManager
enum/V2TimSDKListener
enum/V2TimSignalingListener
enum/V2TimSimpleMsgListener
manager/v2_tim_conversation_manager
manager/v2_tim_friendship_manager
manager/v2_tim_group_manager
manager/v2_tim_manager
manager/v2_tim_message_manager
manager/v2_tim_offline_push_manager
manager/v2_tim_signaling_manager
models/v2_tim_application_processed
models/v2_tim_callback
models/v2_tim_conversation
models/v2_tim_conversation_result
models/v2_tim_custom_elem
models/v2_tim_face_elem
models/v2_tim_file_elem
models/v2_tim_friend_application
models/v2_tim_friend_application_result
models/v2_tim_friend_check_result
models/v2_tim_friend_group
models/v2_tim_friend_info
models/v2_tim_friend_info_result
models/v2_tim_friend_operation_result
models/v2_tim_friend_search_param
models/v2_tim_grant_administrator
models/v2_tim_group_application
models/v2_tim_group_application_result
models/v2_tim_group_at_info
models/v2_tim_group_attribute_changed
models/v2_tim_group_change_info
models/v2_tim_group_created
models/v2_tim_group_dismissed
models/v2_tim_group_info
models/v2_tim_group_info_changed
models/v2_tim_group_info_result
models/v2_tim_group_member
models/v2_tim_group_member_change_info
models/v2_tim_group_member_full_info
models/v2_tim_group_member_info
models/v2_tim_group_member_info_result
models/v2_tim_group_member_operation_result
models/v2_tim_group_member_search_param
models/v2_tim_group_member_search_result
models/v2_tim_group_message_read_member_list
models/v2_tim_group_recycled
models/v2_tim_group_search_param
models/v2_tim_group_tips_elem
models/v2_tim_image
models/v2_tim_image_elem
models/v2_tim_location_elem
models/v2_tim_member
models/v2_tim_member_enter
models/v2_tim_member_info_changed
models/v2_tim_member_invited
models/v2_tim_member_kicked
models/v2_tim_member_leave
models/v2_tim_merger_elem
models/v2_tim_message
models/v2_tim_message_receipt
models/v2_tim_message_search_param
models/v2_tim_message_search_result
models/v2_tim_message_search_result_item
models/v2_tim_msg_create_info_result
models/v2_tim_offline_push_info
models/v2_tim_quit_from_group
models/v2_tim_receive_message_opt_info
models/v2_tim_receive_rest_custom_data
models/v2_tim_recv_c2c_custom_message
models/v2_tim_recv_c2c_text_message
models/v2_tim_recv_group_custom_message
models/v2_tim_recv_group_text_message
models/v2_tim_revoke_administrator
models/v2_tim_signaling_info
models/v2_tim_sound_elem
models/v2_tim_text_elem
models/v2_tim_user_full_info
models/v2_tim_user_info
models/v2_tim_value_callback
models/v2_tim_video_elem