searchConversation method

  1. @override
Future<void> searchConversation(
  1. String searchKey, [
  2. String? jidForSearch,
  3. bool globalSearch = true,
  4. dynamic callback(
    1. FlyResponse response
    )?,
])
override

This method is used to search the conversation using the keyword.

Implementation

@override
Future<void> searchConversation(String searchKey,
    [String? jidForSearch,
    bool globalSearch = true,
    Function(FlyResponse response)? callback]) async {
  //filteredMessageList
  String? response;
  try {
    response =
        await mirrorFlyMethodChannel.invokeMethod('searchConversation', {
      "searchKey": searchKey,
      "jidForSearch": jidForSearch,
      "globalSearch": globalSearch
    });
    callback?.call(FlyResponse(true,
        convertChatMessagesJsonFromString(response), FlyConstants.empty));
    // return convertChatMessagesJsonFromString(response);
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(e.code, e.message, e.details)));
  } on Exception catch (e) {
    LogMessage.d("Exception ", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
  }
}