Tovi

Demo

pub package

This package provides a single class for formatting user input in a text field in Dart/Flutter applications.

Features

🐥 Effortless Number Formatting – automatically formats user input in real-time.

🐥 Custom Separators – choose your preferred thousands and decimal separators.

🐥 Decimal Control – limit decimal places and handle fractions seamlessly.

🐥 Smart Deletion – removes digits or separators without breaking the format.

🐥 Cursor-Friendly – keeps the caret in the right position as you type.

🐥 Plug & Play – works instantly with any Flutter TextField.

Installation

  1. Add the dependency
flutter pub add tovi
  1. Import the package
import 'package:tovi/tovi.dart';
  1. Use in a TextField
TextField(
  keyboardType: TextInputType.numberWithOptions(decimal: true),
  inputFormatters: [
    Tovi(
      thousandsSeparator: ",",
      decimalSeparator: ".",
      maxDecimals: 2,
    ),
  ],
  decoration: InputDecoration(
    labelText: "Enter amount",
  ),
)

💡 Tip: You can customize separators, enable/disable decimals, and set the maximum decimal precision to fit your use case.

Libraries

main
tovi