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.

Libraries

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