createConversation static method

Future<Conversation> createConversation(
  1. List<String> userIds, {
  2. String? image,
})

Creates a conversation with the users specified by userIds.

The image argument can be used to give an image to the conversation.

Implementation

static Future<Conversation> createConversation(
  List<String> userIds, {
  String? image,
}) async {
  MercuryRequest req = await _req();

  if (!userIds.contains(currentUser.id)) userIds.add(currentUser.id);
  req.conversation = Conversation(
    users: userIds.map((_) => User(id: _)),
    image: image,
  );

  MercuryResponse res = await _client.createConversation(req);
  return res.conversation;
}