createGroup static method

Future<void> createGroup({
  1. required String groupName,
  2. required List<String> userList,
  3. required String image,
  4. required dynamic flyCallBack(
    1. FlyResponse response
    ),
})

This method creates a new group with the specified name, user list, and group image. Upon completion, the flyCallBack function is invoked with a FlyResponse object, which contains information about the success or failure of the operation.

Parameters: groupName - The name of the group to be created. userList - A list of JIDs of the users to be added to the group. image - A file path or URL of the image to be used as the group's profile picture.

Returns: flyCallBack - A callback function that is called with a FlyResponse object upon completion.

Example usage:

await Mirrorfly.createGroup(
  groupName: "My Group",
  userList: ["user123@example.com", "user456@example.com"],
  image: "path/to/image.png",
  flyCallBack: (response) {
    if (response.isSuccess) {
      print("Group created successfully");
    } else {
      print("Failed to create group: ${response.errorMessage}");
    }
  },
);

Implementation

static Future<void> createGroup(
    {required String groupName,
    required List<String> userList,
    required String image,
    required Function(FlyResponse response) flyCallBack}) {
  return FlyChatFlutterPlatform.instance
      .createGroup(groupName, userList, image, flyCallBack);
}