exitClientById method

Future<bool> exitClientById(
  1. int clientId, {
  2. bool isClose = false,
  3. String? extra,
  4. bool isInvokeThrowOnError = true,
})

Implementation

Future<bool> exitClientById(
  int clientId, {
  bool isClose = false,
  String? extra,
  bool isInvokeThrowOnError = true,
}) async {
  TdlibClient? tdlibClient = getClientById(clientId);
  if (tdlibClient != null) {
    if (isClose) {
      try {
        await invoke(
          "close",
          clientId: clientId,
          extra: extra,
          isUseCache: false,
          durationCacheExpire: null,
          isVoid: true,
          isInvokeThrowOnError: isInvokeThrowOnError,
        );
      } catch (e) {}
    }

    // sendPort.send(TdlibClientExit(client_id: clientId));
    return (clients.remove(clientId) != null);
  }
  return false;
}