getChats method

Future getChats({
  1. bool? onlyUser,
  2. bool? onlyGroups,
})

get all Chats using getChats

Implementation

Future getChats({bool? onlyUser, bool? onlyGroups}) async {
  if (onlyUser == true) {
    return await wpClient.evaluateJs(
      '''WPP.chat.list({onlyUsers: true});''',
      methodName: "GetChats",
    );
  } else if (onlyGroups == true) {
    return await wpClient.evaluateJs(
      '''WPP.chat.list({onlyGroups: true});''',
      methodName: "GetChats",
    );
  } else {
    return await wpClient.evaluateJs(
      '''WPP.chat.list();''',
      methodName: "GetChats",
    );
  }
}