blockUnblockAPI function

Future<String> blockUnblockAPI(
  1. {required int userId,
  2. required bool isBlock}
)

Implementation

Future<String> blockUnblockAPI({required int userId, required bool isBlock}) async {
  appStore.setLoading(true);

  Map req = {UserKeys.userId: appStore.userId, FriendKey.blockUserId: userId};
  try {
    var res = CommonModel.fromJson(await (handleResponse(await buildHttpResponse(!isBlock ? APIEndPoint.block : APIEndPoint.unblock, request: req, method: HttpMethod.POST))));
    appStore.setLoading(false);
    return res.message.validate();
  } catch (e) {
    appStore.setLoading(false);
    throw errorSomethingWentWrong;
  }
}