openConnectionIfNeeded method Null safety

void openConnectionIfNeeded()

Implementation

void openConnectionIfNeeded() {
  if (!shouldCreateInputConnection) {
    return;
  }

  if (!hasConnection) {
    _lastKnownRemoteTextEditingValue = getTextEditingValue();
    _textInputConnection = TextInput.attach(
      this,
      TextInputConfiguration(
        inputType: TextInputType.multiline,
        readOnly: widget.readOnly,
        inputAction: TextInputAction.newline,
        enableSuggestions: !widget.readOnly,
        keyboardAppearance: widget.keyboardAppearance,
        textCapitalization: widget.textCapitalization,
      ),
    );

    _textInputConnection!.setEditingState(_lastKnownRemoteTextEditingValue!);
    // _sentRemoteValues.add(_lastKnownRemoteTextEditingValue);
  }

  _textInputConnection!.show();
}