Skip to content
pubscout

flutter_libphonenumber

2.8.4, released 4 months ago by coutts-consulting.com

Synchronous and asynchronous phone number formatting and parsing in Flutter apps.

WASM-ready
$ flutter pub add flutter_libphonenumber
Source repository

What it does

Wraps native libphonenumber libraries (libphonenumber and PhoneNumberKit) to provide formatting, parsing, and real-time masking for phone numbers. It preloads region masks during initialization to allow synchronous number formatting.

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

Use it when

  • You need to format and validate international phone numbers in forms or text fields.
  • You require synchronous phone number formatting to avoid UI jank during typing.

Skip it when

  • You need a general-purpose text masking library not specifically meant for phone numbers.

Strengths

  • Supports synchronous formatting using preloaded masks.
  • Provides a TextField input formatter for real-time validation and masking.
  • Cross-platform support including Android, iOS, Web, and macOS.

Weaknesses

  • Requires an explicit `init()` call prior to use or synchronous formatting will fail.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
4

Must call await init() before formatting phone numbers or using text formatters.

await init();
final rawNumber = '+14145556666';
final formattedNumber = formatNumberSync(rawNumber);

Alternatives

Packages that do the same job and could replace flutter_libphonenumber.

  • intl

    A Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.

  • intl_translation

    Generates Dart code for intl messages from ARB files for localization.

  • phone_input

    This package is designed to simplify the process of capturing phone numbers from users.

  • locale_plus

    Access native device locale data like language, country code, time zone, and number formats.