bhrott / flutter-masked-text

A masked text for Flutter.
https://pub.dartlang.org/packages/flutter_masked_text
MIT License
276 stars 124 forks source link

Empty field triggers errors on MoneyMaskedTextController #69

Open thiagocordeiro opened 3 years ago

thiagocordeiro commented 3 years ago

When the user selects the text and deletes it, flutter triggers the following error:

======== Exception caught by foundation library ====================================================
The following RangeError was thrown while dispatching notifications for MoneyMaskedTextController:
Invalid value: Only valid value is 0: -2

When the exception was thrown, this was the stack: 
#0      List.insert (dart:core-patch/growable_array.dart:11:7)
#1      MoneyMaskedTextController.numberValue (package:flutter_masked_text/flutter_masked_text.dart:189:11)
#2      new MoneyMaskedTextController.<anonymous closure> (package:flutter_masked_text/flutter_masked_text.dart:140:29)
#3      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:243:25)
#4      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:309:5)