phone_number_text_input_formatter 0.0.1 copy "phone_number_text_input_formatter: ^0.0.1" to clipboard
phone_number_text_input_formatter: ^0.0.1 copied to clipboard

A lightweight and efficient solution for formatting phone numbers within your Flutter applications.

Phone Number Text Input Formatter #

This is a Flutter package built to provide phone number formatting functionality during text input. It's a key helper in creating phone number input fields that need to restrict and validate user input in a formatted manner.

Features #

  • Zero dependency
  • Efficiently formats the phone numbers on-the-fly, with better performance than regular expression-based solutions.
  • You can customize the format according to your needs, giving you more flexibility and control.
  • Comes with pre-implemented popular international and national phone number formats.

Usage #

Format the phone number using all available international formats:

TextField(
  keyboardType: TextInputType.phone,
  inputFormatters: [
    FilteringTextInputFormatter.allow(RegExp(r'[0-9,+]')),
    const PhoneNumberTextInputFormatter(prefix: '+'),
  ],
)

Format the US phone number in international format:

TextField(
  keyboardType: TextInputType.phone,
  inputFormatters: [
    FilteringTextInputFormatter.allow(RegExp(r'[0-9,+]')),
    const PhoneNumberTextInputFormatter(
      prefix: '+',
      format: PhoneNumberFormat.international,
    ),
  ],
)
1
likes
140
pub points
74%
popularity

Publisher

verified publishersummerhammer.dev

A lightweight and efficient solution for formatting phone numbers within your Flutter applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on phone_number_text_input_formatter