decimalValueFormatter static method

FilteringTextInputFormatter decimalValueFormatter({
  1. int decimalPlaceValue = 2,
  2. bool allowedSign = false,
})

validation input decimal value

Implementation

static FilteringTextInputFormatter decimalValueFormatter({
  int decimalPlaceValue = 2,
  bool allowedSign = false,
}) {
  return allowedSign
      ? FilteringTextInputFormatter.allow(
          RegExp(
            r'^\d+\.?\d{0,'
            "${decimalPlaceValue.toString()}"
            '}',
          ),
        )
      : FilteringTextInputFormatter.allow(
          RegExp(
            r'^\d+\.?\d{0,'
            "${decimalPlaceValue.toString()}"
            '}',
          ),
        );
}