title: Flutter: Using NumberFormat in TextInputFormatter
body: <p>I'm trying to use <code>NumberFromatter</code> in <code>TextInputFormatter</code> but when I try to use it, it completely messed up! This is my <code>TextInputFormatter</code> implementation code:</p>
  
  <pre><code>class NumericTextFormatter extends TextInputFormatter {
    TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
      if(newValue.text.length &gt; 0) {
        int num = int.parse(newValue.text.replaceAll(',', ''));
        final f = new NumberFormat("#,###");
        return newValue.copyWith(text: f.format(num));
      } else { 
        return newValue.copyWith(text: '');
      }
    }
  }
  </code></pre>
  
  <p>So when I add this formatter to a <code>TextField</code> and try to type 1 to 9, what I expect to see is something like: <code>123,456,789</code></p>
  
  <p>But this is what shows in <code>TextField</code>:</p>
  
  <pre><code>1
  12
  123
  1,234
  12,354 &lt;- this is where it starts
  123,564
  1,235,674
  12,356,874 &lt;- and it happends again
  </code></pre>
  
  <p>It seems that cursor moves after adding one , character. So can anyone helps me with this?</p>