Browse SDKs · Flutter
Platform
SDKsFlutter

Create a group

Create a new OpenIM group and configure initial members in the Flutter SDK.

Copy

Create a new group while defining its name, group type, and initial roster of owner, administrators, and regular members:

Parameters

ParameterTypeRequiredDescription
groupInfoGroupInfoYesBasic group metadata including groupName and groupType (for example, GroupType.work for work groups). Pass an empty string '' for groupID to have the server generate a unique ID.
memberUserIDsList<String>?NoInitial list of regular member user IDs.
adminUserIDsList<String>?NoInitial list of administrator user IDs.
ownerUserIDString?NoInitial group owner user ID; defaults to the current creator if omitted.

Keep user IDs mutually exclusive across memberUserIDs, adminUserIDs, and ownerUserID.

Code example

final group = await OpenIM.iMManager.groupManager.createGroup(
  groupInfo: GroupInfo(groupID: '', groupName: 'Project Team', groupType: GroupType.work),
  memberUserIDs: ['user-003'],
  adminUserIDs: ['user-002'],
  ownerUserID: currentUserID,
);

Return value

A successful Future returns the newly created GroupInfo object containing the server-assigned groupID.

State changes after the call

The creator and invited members receive join group notifications via group listeners. The client merges the new group into its joined group list using groupID as the key. For complete listener integration, see Groups overview.