Skip to content

How to create a new channel with stream_chat_flutter 9.x? #2080

@mauriziopinotti

Description

@mauriziopinotti

With stream_chat_flutter 8.x I used to create channels following the example app:

// in initState()
_channel = StreamChat.of(context).client.channel('messaging');

// then after the user selects the members for the new channel
  _channel = chatState.client.channel('messaging', extraData: {
    'members': [
      ..._selectedUsers.map((e) => e.id),
      chatState.currentUser!.id,
    ],
    'team': myteam,
  });

However, this no longer works with 9.x, I get

StreamChatNetworkError(code: 4, message: GetOrCreateChannel failed with error: "When using member based IDs specify at least 2 members", statusCode: 400, data: ErrorResponse(code: 4, message: GetOrCreateChannel failed with error: "When using member based IDs specify at least 2 members", statusCode: 400,

The example app does not have a create feature, how should channels be created in 9.x?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexample:stream_chat_coreBug in stream_chat_core sample appsdk-issueUsed for issues/bugs opened/reported by customers or us.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions