Skip to main content
This guide helps you migrate from CometChat Flutter UI Kit V5 to V6. V6 is a major architectural refactor that introduces clean architecture with BLoC state management while maintaining the same user-facing widget APIs.

Key Changes

AreaV5V6
State ManagementControllers (e.g. CometChatUsersController)BLoC (flutter_bloc: ^8.1.0)
ArchitectureFlat layout with controllersClean Architecture (bloc/data/domain/di)
Data AccessDataSource decorator chainMessageTemplateUtils static methods
ExtensionsRegistered via UIKitSettingsBuilt-in, no registration needed
Shared UIExternal cometchat_uikit_shared packageSingle cometchat_chat_uikit package

Step-by-Step Migration

1. Update Imports

// V5 — two imports needed
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
import 'package:cometchat_uikit_shared/cometchat_uikit_shared.dart';

// V6 — single import covers everything
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';

2. Update Initialization

// V5
UIKitSettings settings = (UIKitSettingsBuilder()
  ..appId = "..."
  ..region = "..."
  ..authKey = "..."
  ..extensions = CometChatUIKitChatExtensions.getDefaultExtensions()
  ..aiFeature = CometChatUIKitChatAIFeatures.getDefaultAiFeatures()
).build();

// V6 — remove extensions and aiFeature
UIKitSettings settings = (UIKitSettingsBuilder()
  ..appId = "..."
  ..region = "..."
  ..authKey = "..."
).build();

3. Replace DataSource Calls

// V5
CometChatUIKit.getDataSource().getTextMessageBubble(msg, ctx, align);
ChatConfigurator.getDataSource().getAllMessageTemplates();

// V6
MessageTemplateUtils.getTextMessageBubble(msg, ctx, align);
MessageTemplateUtils.getAllMessageTemplates();

4. Update Dependencies

Install V6 via CLI (hosted on Cloudsmith):
dart pub add cometchat_chat_uikit:6.0.0-beta1 --hosted-url https://dart.cloudsmith.io/cometchat/cometchat/
Or add manually to pubspec.yaml:
dependencies:
  cometchat_chat_uikit:
    hosted: https://dart.cloudsmith.io/cometchat/cometchat/
    version: 6.0.0-beta1

5. State Management Migration (Advanced)

If you were directly using controllers:
// V5 — Controller
CometChatUsersController controller = CometChatUsersController(...);

// V6 — BLoC
BlocProvider(
  create: (_) => UsersBloc()..add(LoadUsers()),
  child: BlocBuilder<UsersBloc, UsersState>(
    builder: (context, state) {
      if (state is UsersLoaded) return buildUI(state.users);
      return const CircularProgressIndicator();
    },
  ),
);

Controller → BLoC Mapping

V5 ControllerV6 BLoC
CometChatConversationsControllerConversationsBloc
CometChatUsersControllerUsersBloc
CometChatGroupsControllerGroupsBloc
CometChatGroupMembersControllerGroupMembersBloc
CometChatMessageComposerControllerMessageComposerBloc
CometChatMessageHeaderControllerMessageHeaderBloc
CometChatMessageListControllerMessageListBloc

Migration Checklist

  1. ☐ Replace all CometChatXxxController usage with XxxBloc
  2. ☐ Replace CometChatUIKit.getDataSource().xxx() with MessageTemplateUtils.xxx()
  3. ☐ Remove extensions and aiFeature from UIKitSettings
  4. ☐ Replace cometchat_uikit_shared imports with cometchat_chat_uikit
  5. ☐ Test all features after migration

Property Changes

This section outlines the property changes between V5 and V6. V6 introduces BLoC-based state management and consolidates styling into ThemeData extensions.

Architectural Changes

AspectV5V6
State ManagementControllersBLoC
Data SourceCometChatUIKit.getDataSource()MessageTemplateUtils
Extension RegistrationUIKitSettings.extensionsHandled internally
Rich TextNot availableBuilt-in rich text formatting
Code BlocksNot availableBuilt-in code block support

Conversations

New Properties (V6)

NameTypeDescription
conversationsBlocConversationsBloc?Provide a custom BLoC instance
routeObserverRouteObserver?Freeze rebuilds during navigation
hideSearchbool?Hide the search bar
searchReadOnlybool?Make search bar read-only
onSearchTapVoidCallback?Callback when search is tapped

Removed Properties (from V5)

NameDescription
themeReplaced by ThemeData extensions
errorStateText, emptyStateText, loadingStateTextUse custom state views instead
stateCallBackUse BLoC events instead
avatarStyle, statusIndicatorStyle, badgeStyle, receiptStyle, dateStyleConsolidated into CometChatConversationsStyle
hideSeparatorControlled via style
disableTypingHandled internally
deleteConversationDialogStyleIntegrated into main style
disableMentionsHandled via text formatters

Message List

New Properties (V6)

NameTypeDescription
messageListBlocMessageListBloc?Provide a custom BLoC instance
enableConversationStartersboolEnable AI conversation starters
enableSmartRepliesboolEnable AI smart replies
addTemplateList<CometChatMessageTemplate>?Add custom templates to existing ones
hideModerationViewboolHide moderation view

Removed Properties (from V5)

NameDescription
themeReplaced by ThemeData extensions
scrollToBottomOnNewMessagesHandled internally
timestampAlignmentControlled via style
messageInformationConfigurationHandled via BLoC
reactionListConfiguration, reactionsConfigurationSimplified

Message Composer

New Properties (V6)

NameTypeDescription
messageComposerBlocMessageComposerBloc?Provide a custom BLoC instance
hideSendButtonbool?Hide send button
hideAttachmentButtonbool?Hide attachment button
hideStickersButtonbool?Hide sticker button
hideImageAttachmentOptionbool?Hide image attachment
hideVideoAttachmentOptionbool?Hide video attachment
hideAudioAttachmentOptionbool?Hide audio attachment
hideFileAttachmentOptionbool?Hide file attachment
hidePollsOptionbool?Hide polls option
hideCollaborativeDocumentOptionbool?Hide collaborative document
hideCollaborativeWhiteboardOptionbool?Hide collaborative whiteboard
hideTakePhotoOptionbool?Hide take photo option

Removed Properties (from V5)

NameDescription
themeReplaced by ThemeData extensions
hideLiveReaction, liveReactionIcon, liveReactionIconURLFeature removed
mediaRecorderStyleIntegrated into main style

Message Header

New Properties (V6)

NameTypeDescription
titleViewWidget? Function(Group?, User?, BuildContext)?Custom title widget
leadingStateViewWidget? Function(Group?, User?, BuildContext)?Custom leading widget
auxiliaryButtonViewWidget? Function(Group?, User?, BuildContext)?Custom auxiliary button
hideVideoCallButtonbool?Hide video call button
hideVoiceCallButtonbool?Hide voice call button

Removed Properties (from V5)

NameDescription
themeReplaced by ThemeData extensions
avatarStyle, statusIndicatorStyleConsolidated into CometChatMessageHeaderStyle
privateGroupIcon, protectedGroupIconHandled via style
disableTypingHandled internally

Users

New Properties (V6)

NameTypeDescription
usersBlocUsersBloc?Provide a custom BLoC instance
setOptionsFunction?Set long press actions
addOptionsFunction?Add to long press actions
trailingViewWidget? Function(BuildContext, User)?Custom trailing widget
leadingViewWidget? Function(BuildContext, User)?Custom leading widget
titleViewWidget? Function(BuildContext, User)?Custom title widget

Removed Properties (from V5)

NameDescription
themeReplaced by ThemeData extensions
listItemStyle, avatarStyle, statusIndicatorStyleConsolidated into CometChatUsersStyle
optionsReplaced by setOptions/addOptions

Groups

New Properties (V6)

NameTypeDescription
groupsBlocGroupsBloc?Provide a custom BLoC instance
groupTypeVisibilityboolHide group type icon
setOptionsFunction?Set long press actions
addOptionsFunction?Add to long press actions
trailingViewWidget? Function(BuildContext, Group)?Custom trailing widget
leadingViewWidget? Function(BuildContext, Group)?Custom leading widget
titleViewWidget? Function(BuildContext, Group)?Custom title widget

Removed Properties (from V5)

NameDescription
themeReplaced by ThemeData extensions
listItemStyle, avatarStyle, statusIndicatorStyleConsolidated into CometChatGroupsStyle
optionsReplaced by setOptions/addOptions

Group Members

New Properties (V6)

NameTypeDescription
hideKickMemberOptionbool?Control kick member visibility
hideBanMemberOptionbool?Control ban member visibility
hideScopeChangeOptionbool?Control scope change visibility
usersStatusVisibilityboolControl status indicator visibility

Renamed Properties

V5 NameV6 NameDescription
tailViewtrailingViewCustom trailing widget
disableUsersPresenceusersStatusVisibilityInverted logic
groupMemberStylestyleType changed to CometChatGroupMembersStyle