createGroupAsync method

Future<String> createGroupAsync({
  1. String groupName = "",
  2. required List<String> members,
  3. required List<String> admins,
  4. SealdGeneratedPrivateKeys? privateKeys,
})

Create a group and return the created group's ID. admins must also be members. admins must include yourself.

groupName - A name for the group. This is metadata, useful on the Seald Dashboard for recognizing this user. members - The Seald IDs of the members to add to the group. Must include yourself. admins - The Seald IDs of the members to also add as group admins. Must include yourself. privateKeys - Optional. Pre-generated private keys, returned by a call to SealdSdk.generatePrivateKeysAsync.

Returns the ID of the created group.

Implementation

Future<String> createGroupAsync(
    {String groupName = "",
    required List<String> members,
    required List<String> admins,
    SealdGeneratedPrivateKeys? privateKeys}) {
  return compute((Map<String, dynamic> args) async {
    privateKeys ??= await generatePrivateKeysAsync();
    return createGroup(
        groupName: args["groupName"],
        members: args["members"],
        admins: args["admins"],
        privateKeys: privateKeys);
  }, {"groupName": groupName, "members": members, "admins": admins});
}