tagConversation static method
Future<Conversation?>
tagConversation(
- String conversationWith,
- String conversationType,
- List<
String> tags, { - required dynamic onSuccess(
- Conversation conversation
- required dynamic onError(
- CometChatException excep
Tag a conversation
conversationWith The id of conversation
conversationType The user or group
Tag a conversation with custom tags.
Migration Note: Migrated from platform channels to native Dart implementation. Uses ConversationRepository for tagging conversations. Behavior and signature remain identical for backward compatibility.
Android Reference: CometChat.tagConversation(String conversationWith, String conversationType, List<String> tags, CallbackListener<Conversation>)
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<Conversation?> tagConversation(
String conversationWith, String conversationType, List<String> tags,
{required Function(Conversation conversation)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
// Get SDK instance
final sdk = SdkRegistry.getInstance();
// Call native Dart conversation repository
final conversation = await sdk.conversations.tagConversation(
conversationWith,
conversationType,
tags,
);
// Call success callback
if (onSuccess != null) onSuccess(conversation);
return conversation;
} on SdkException catch (sdkEx) {
// Convert SdkException to CometChatException
final cometChatEx = CometChatException(
sdkEx.code,
sdkEx.details ?? sdkEx.message,
sdkEx.message,
);
_errorCallbackHandler(cometChatEx, null, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
return null;
}