disconnect method

Future disconnect({
  1. Duration? timeout,
})
override

timeout: milliseconds to wait after closing the socket

Implementation

Future disconnect({Duration? timeout}) async {
  await socket?.flush();
  await socket?.close();
  if (timeout != null) {
    await Future.delayed(timeout, () => null);
  }
}