Key Changes
| Area | V5 | V6 |
|---|---|---|
| State Management | GetX (get: ^4.6.5) | BLoC (flutter_bloc: ^8.1.0) |
| Architecture | Flat layout with controllers | Clean Architecture (bloc/data/domain/di) |
| Data Access | DataSource decorator chain (10 layers) | MessageTemplateUtils static methods (1 hop) |
| Extensions | Registered via UIKitSettings | Built-in, no registration needed |
| Shared UI | External cometchat_uikit_shared package | Internalized into lib/shared_ui/ |
| Composite Widgets | CometChatMessages, CometChatConversationsWithMessages | Removed — compose UI yourself |
Step-by-Step Migration
1. Update Imports
2. Update Initialization
3. Replace DataSource Calls
4. Replace Composite Widgets
5. Widget Renames
6. Update Dependencies
Install V6 via CLI (hosted on Cloudsmith):pubspec.yaml:
pubspec.yaml:
7. State Management Migration (Advanced)
If you were directly using GetX controllers:Controller → BLoC Mapping
| V5 Controller | V6 BLoC |
|---|---|
CometChatConversationsController | ConversationsBloc |
CometChatUsersController | UsersBloc |
CometChatGroupsController | GroupsBloc |
CometChatGroupMembersController | GroupMembersBloc |
CometChatMessageComposerController | MessageComposerBloc |
CometChatMessageHeaderController | MessageHeaderBloc |
CometChatMessageListController | MessageListBloc |
CometchatMessageInformationController | MessageInformationBloc |
CometChatThreadedHeaderController | ThreadedHeaderBloc |
CometChatSearchController | SearchBloc |
Migration Checklist
- ☐ Replace all
CometChatXxxControllerusage withXxxBloc - ☐ Replace
GetBuilder<T>withBlocBuilder<XxxBloc, XxxState> - ☐ Replace
CometChatUIKit.getDataSource().xxx()withMessageTemplateUtils.xxx() - ☐ Remove
extensionsandaiFeaturefromUIKitSettings - ☐ Update imports from
src/tochat_ui/src/ - ☐ Replace
cometchat_uikit_sharedpackage import with internalshared_ui/ - ☐ Rename
CometChatEditPreview→CometChatMessagePreview - ☐ Replace composite widgets with individual widget composition
- ☐ Add new dependencies (flutter_bloc, equatable, etc.)
- ☐ Remove
cometchat_uikit_shareddependency - ☐ Test all features after migration