Skip to content
pubscout

amount_input_formatter

0.2.1, released 2 years ago by tbrgroup.software

A configurable number input formatter for TextField to format amounts, group digits, and access double values.

WASM-ready
$ flutter pub add amount_input_formatter
Source repository

What it does

Provides a TextInputFormatter that manages digit group separation, maximum integral and decimal lengths, and caret behavior for numeric TextField inputs. It allows easy extraction of the underlying double value and syncing with TextEditingControllers.

AI-written summary of version 0.2.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to format currency or amount inputs in a TextField with custom digit group and decimal separators.
  • You need direct access to the underlying double value of the formatted text input.

Skip it when

  • You require complex multi-locale internationalized number formatting (where intl might be preferred).
  • You need precise high-precision decimal arithmetic beyond standard double floating-point limitations.

Strengths

  • Minimizes common headaches associated with using intl NumberFormat inside a TextField.
  • Easily exposes the underlying double value and formatted string.
  • Configurable separators and length limits for integral and fractional parts.

Weaknesses

  • Susceptible to standard Dart double IEEE 754 floating-point precision limitations for high-precision calculations.
  • Requires manual TextEditingController attachment for dynamic external updates.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
TextField(
  inputFormatters: [AmountInputFormatter()],
)

Alternatives

Packages that do the same job and could replace amount_input_formatter.