tagConversation static method

Future<Conversation?> tagConversation(
  1. String conversationWith,
  2. String conversationType,
  3. List<String> tags, {
  4. required dynamic onSuccess(
    1. Conversation conversation
    )?,
  5. required dynamic onError(
    1. CometChatException excep
    )?,
})

Tag a conversation

conversationWith The id of conversation

conversationType The user or group

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 {
    final result = await channel.invokeMethod('tagConversation', {
      'conversationWith': conversationWith,
      'conversationType': conversationType,
      'tags': tags
    });
    final res = Conversation.fromMap(result);
    if(onSuccess != null) onSuccess(res);
    return res;
  } on PlatformException catch (platformException) {
    if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
  } catch (e) {
    debugPrint("Error: $e");
    if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
  }
  return null;
}