I have a text field and it has an onSubmit method, inside which I check for validation and then focus on another field, but for some reason the focus does not work
onSubmitted: (value) {
        //print("ga test");

        if (!widget.validator?.call(value)) {
          setState(() {
            showError = true;
          });
        }
        if (widget.nextFocus != null) {
          FocusScope.of(context).requestFocus(widget.nextFocus);
        }

      },


How do I change the focus of the text field on Submit?
I did so and it worked
if (widget.validator != null) {
          setState(() {
            showError = !widget.validator?.call(value);
          });
        }
        if (widget.nextFocus != null) {
          FocusScope.of(context).requestFocus(widget.nextFocus);
        }

