getLoginUser method

Future<V2TimValueCallback<String>> getLoginUser()

Implementation

Future<V2TimValueCallback<String>> getLoginUser() async {
  try {
    final userProfile =
        await wrappedPromiseToFuture(V2TIMManagerWeb.timWeb!.getMyProfile());
    final code = userProfile.code;
    final profile = jsToMap(userProfile.data);
    if (code == 0) {
      return CommonUtils.returnSuccess<String>(profile["userID"]);
    } else {
      return CommonUtils.returnErrorForValueCb('获取失败!');
    }
  } catch (error) {
    return CommonUtils.returnErrorForValueCb(error);
  }
}