title: How to clear error message in TextFormField in Flutter
body: <p>In my code I validate phone number. If phone number is incorrect - I show error message. But, when user starts to edit number I want to hide this error message.</p>
  
  <p>I've found the solution with <code>currentState.reset()</code>, but it seems not the good one. I have to handle issues with saving text and cursor position. And I still have one small artifact. Normally when I press and hold backspace - it deletes symbols one by one. If I do it when error message is shown - then error message disappears and only one symbol is deleted.</p>
  
  <p>Does anybody know the right solution for this case?</p>
  
  <pre><code>final TextEditingController controller = TextEditingController();
  final RegExp _phoneRegex = RegExp(r"^\+{1}\d{10, 15}\$");
  bool isError = false;
  TextSelection currentPosition;
  
  return Column(
    children: &lt;Widget&gt;[
      Form(
          key: _textKey,
          child: TextFormField(
            controller: controller,
            validator: (str) {
              isError = true;
              if (str.isEmpty) {
                return err_empty_field;
              } else if (!_phoneRegex.hasMatch(str)) {
                return err_invalid_phone;
              }
              isError = false;
            },
          ),
          onChanged: () {
            if (controller.selection.start &lt; 0 &amp;&amp;
                controller.text.length &gt; 0) {
              TextSelection position =
                  controller.text.length &gt; currentPosition.start
                      ? currentPosition
                      : TextSelection.fromPosition(
                          TextPosition(offset: controller.text.length));
              controller.selection = position;
            }
            if (isError) {
              isError = false;
              currentPosition = controller.selection;
              if (currentPosition.start &gt; controller.text.length) {
                currentPosition = TextSelection.fromPosition(
                    TextPosition(offset: controller.text.length));
              }
              String currentText = controller.text;
              _textKey.currentState.reset();
              controller.text = currentText;
              controller.selection = currentPosition;
            }
          },
        ),
      RaisedButton(
        onPressed: () {
          _textKey.currentState.validate();
        },
        child: Text(login),
      )
    ],
  );
  </code></pre>