I'm trying to use `NumberFromatter` in `TextInputFormatter` but when I try to use it, it completely messed up! This is my `TextInputFormatter` implementation code:

```
class NumericTextFormatter extends TextInputFormatter {
  TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
    if(newValue.text.length > 0) {
      int num = int.parse(newValue.text.replaceAll(',', ''));
      final f = new NumberFormat("#,###");
      return newValue.copyWith(text: f.format(num));
    } else { 
      return newValue.copyWith(text: '');
    }
  }
}

```

So when I add this formatter to a `TextField` and try to type 1 to 9, what I expect to see is something like: `123,456,789`

But this is what shows in `TextField`:

```
1
12
123
1,234
12,354 <- this is where it starts
123,564
1,235,674
12,356,874 <- and it happends again

```

It seems that cursor moves after adding one , character. So can anyone helps me with this?