addRequest method

bool addRequest(
  1. String userId,
  2. String? reason, [
  3. bool isGroup = false
])

Implementation

bool addRequest(String userId, String? reason, [bool isGroup = false]) {
  List requestList = cachedMap[requestsKey] ?? [];
  if (requestList.any((element) =>
      element['id'] == userId && element['isGroup'] == isGroup)) {
    return false;
  }
  requestList.add({
    'id': userId,
    'reason': reason,
    'isGroup': isGroup,
    'isRead': false,
  });
  cachedMap[requestsKey] = requestList;
  ChatUIKit.instance.onFriendRequestCountChanged(newRequestCount());
  _updateStore();
  return true;
}