Search packages, repositories and app categories

pattern_formatter cover
Package detailsv5.0.0

pattern_formatter

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

AndroidiOSWebmacOSWindowsLinux
30-day downloads
33.4K
Likes
310
Pub points
150

Install package

flutter pub add pattern_formatter

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Pattern Formatter is a Flutter package that offers customizable TextInputFormatter implementations to format user input according to predefined patterns. It enables developers to create masked inputs such as phone numbers, dates, or custom formats with ease. The package supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring consistent behavior across devices. It simplifies form handling by automatically applying formatting as users type, improving UX for structured data entry.

Use cases

  • Form inputs with fixed formats
  • Phone number masking
  • Date and time input formatting
  • Credit card number formatting
  • Custom pattern-based text input
  • Dynamic mask generation

Key features

  • Predefined pattern templates
  • Real-time input formatting
  • Cross-platform compatibility
  • Extensible pattern definitions
  • Simple integration with TextFormField
  • Supports dynamic and static masks

Suitable for

  • Developers building forms with structured input
  • Apps requiring formatted data entry
  • Projects needing consistent input styling
  • Teams prioritizing UX in data collection
  • Mobile and web applications with input validation needs

Considerations

  • May require careful pattern definition to avoid conflicts
  • Limited built-in patterns (custom logic needed for complex cases)
  • Potential performance impact with very long patterns
  • Not designed for non-text input types
  • Requires understanding of TextEditingValue and formatter flow

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

PatternFormatter

pub package codecov

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

How to use

import 'package:pattern_formatter/pattern_formatter.dart';
Thousands grouping
  • Integer number:

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    ThousandsFormatter()
  ],
)
  • Decimal number:

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    ThousandsFormatter(allowFraction: true)
  ],
)
Card number grouping

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    CreditCardFormatter(),
  ],
)
Date format

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    DateInputFormatter(),
  ],
)

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package