bhrott / flutter-masked-text

A masked text for Flutter.

Home Page:https://pub.dartlang.org/packages/flutter_masked_text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This does not work with TextFormField

chitgoks opened this issue · comments

text_form_field.dart': Failed assertion: line 123 pos 15: 'initialValue == null || controller == null': is not true.

final MoneyMaskedTextController moneyMask = MoneyMaskedTextController();
TextFormField(
                        controller: moneyMask,
                        decoration: InputDecoration(labelText: 'Currency'),
                        initialValue: 0,
                        keyboardType: TextInputType.numberWithOptions(decimal: true),
                        onChanged: (value) {
                          value = moneyMask.text;
                          print(value);
                        },
                        onSaved: (value) {
                          moneyMask.updateValue(double.parse(value));
                        },
                      ),

Hey, did you solve this problem? I'm facing this problem right now.

yes. you do not use both controller and initialValue at the same time