close method

Future<void> close({
  1. Duration timeout = const Duration(seconds: 15),
})

Asks TDLib to close this client and waits up to timeout for authorizationStateClosed. The client can't be used afterwards; its database stays on disk.

Implementation

Future<void> close({Duration timeout = const Duration(seconds: 15)}) async {
  if (isClosed) return;
  try {
    send(const Close());
  } on TdClientClosedException {
    return;
  }
  await _closed.future.timeout(timeout, onTimeout: () {});
}