I want to know about NumberFormat.currency constructor in flutter.
I don't know how to implement please guide me, thank you.
class CurrencyInputFormatter extends TextInputFormatter{
@override
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
// TODO: implement formatEditUpdate
if(newValue.selection.baseOffset == 0){
print(true);
return newValue;
}
double value = double.parse(newValue.text);
final formatter = new NumberFormat.currency();
String newText = formatter.format(value/100);
return newValue.copyWith(text: newText,
selection: new TextSelection.collapsed(offset: newText.length));
}
}