startKeepAliveThread method

void startKeepAliveThread()

Starts the keep-alive thread by awaiting an uncompleted Completer.

This method will block the current execution thread until stopKeepAliveThread is called, making it suitable for use at the end of a main() method to prevent premature VM exit.

Implementation

void startKeepAliveThread() async {
  if (completer.isCompleted) {
    completer = Completer<void>();
  }

  await completer.future;
}