isFriendsWithThisUser method
Check if that user sent us friend request and we also sent them one back.
Implementation
bool isFriendsWithThisUser(LocalityUser otherUser) {
// Check if the owner has sent a friend request to the other user
bool ownerSentRequest = friendRequests.any((friendRequest) =>
friendRequest.sender.id == owner.id &&
friendRequest.recipient.id == otherUser.id);
// Check if the owner has received a friend request from the other user
bool ownerReceivedRequest = friendRequests.any((friendRequest) =>
friendRequest.sender.id == otherUser.id &&
friendRequest.recipient.id == owner.id);
// Both conditions must be true for them to be friends
return ownerSentRequest && ownerReceivedRequest;
}