TextInputFormatters class

Provides factory methods for common text input formatters.

TextInputFormatters is a utility class that creates various pre-configured TextInputFormatter instances for common formatting needs like uppercase/lowercase conversion, numeric input, time formatting, and more.

Example:

TextField(
  inputFormatters: [
    TextInputFormatters.toUpperCase,
    TextInputFormatters.integerOnly(min: 0, max: 100),
  ],
)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

digitsOnly({double? min, double? max, int? decimalDigits}) TextInputFormatter
Creates a formatter that only allows decimal numeric input.
hex({bool hashPrefix = false}) TextInputFormatter
Creates a formatter for hexadecimal input.
integerOnly({int? min, int? max}) TextInputFormatter
Creates a formatter that only allows integer input with optional min/max bounds.
mathExpression({Map<String, dynamic>? context}) TextInputFormatter
Creates a formatter that evaluates mathematical expressions.
time({required int length}) TextInputFormatter
Creates a formatter for time input with leading zeros.

Constants

toLowerCase → const TextInputFormatter
Converts all input text to lowercase.
toUpperCase → const TextInputFormatter
Converts all input text to uppercase.