openOrCloseConnection method Null safety

void openOrCloseConnection()

Opens or closes input connection based on the current state of focusNode and value.

Implementation

void openOrCloseConnection() {
  if (widget.focusNode.hasFocus && widget.focusNode.consumeKeyboardToken()) {
    openConnectionIfNeeded();
  } else if (!widget.focusNode.hasFocus) {
    closeConnectionIfNeeded();
  }
}