initSDK method

V2TimValueCallback<bool> initSDK({
  1. required int sdkAppID,
  2. V2TimSDKListener? listener,
})

Implementation

V2TimValueCallback<bool> initSDK(
    {required int sdkAppID, V2TimSDKListener? listener}) {
  sdkListener = listener;
  TimParams timParams = TimParams();
  timParams.SDKAppID = sdkAppID;
  V2TIMManagerWeb.initWebTim(timParams);
  // 初始化各个List
  V2TIMManagerWeb.timWeb!.on(EventType.SDK_READY, allowInterop((res) {
    initFriendList();
    initBlackList();
    initFriendApplicationList();
    listener!.onConnectSuccess();
    completer.complete(true);
  }));

  V2TIMManagerWeb.timWeb!.on(EventType.KICKED_OUT, allowInterop((res) {
    listener!.onKickedOffline();
  }));

  V2TIMManagerWeb.timWeb!
      .on(EventType.PROFILE_UPDATED, _profileUpdateHandler);

  return CommonUtils.returnSuccess<bool>(true);
}