joinGroup static method

Future<V2TimCallback> joinGroup({
  1. required String groupID,
  2. required String message,
  3. String? groupType,
})

Implementation

static Future<V2TimCallback> joinGroup({
  required String groupID,
  required String message,
  String? groupType,
}) async {
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> group_id = Tools.string2PointerInt8(groupID);
  Pointer<Uint8> hello_msg = Tools.string2PointerInt8(message);

  int res = desktopSDK.D_TIMGroupJoin(group_id, hello_msg, user_data);

  if (res != TIMResult.TIM_SUCC) {
    return V2TimCallback.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    return V2TimCallback.fromJson({
      "code": data["code"],
      "desc": data["desc"],
    });
  }
}