createGroup method

dynamic createGroup(
  1. BuildContext context
)

Implementation

createGroup(BuildContext context) async {
  String gUid = "group_${DateTime.now().millisecondsSinceEpoch.toString()}";

  showLoadingIndicatorDialog(context,
      background: theme.palette.getBackground(),
      progressIndicatorColor: theme.palette.getPrimary(),
      shadowColor: theme.palette.getAccent300());

  isLoading = true;

  update();

  Group group = Group(
      guid: gUid,
      name: groupName,
      type: groupType,
      password:
          groupType == GroupTypeConstants.password ? groupPassword : null);
  CometChat.createGroup(
      group: group,
      onSuccess: (Group group) {
        if (kDebugMode) {
          debugPrint("Group Created Successfully : $group ");
        }
        Navigator.pop(context); //pop loading indicator
        isLoading = false;
        Navigator.pop(context);
        CometChatGroupEvents.ccGroupCreated(group);
      },
      onError: onError ??
          (CometChatException e) {
            Navigator.pop(context); //pop loading indicator
            isLoading = false;
            update();
            debugPrint("Group Creation failed with exception: ${e.message}");
          });
}