Skip to content
pubscout

libphonenumber_plugin

0.3.3, released 3 years ago by an unverified publisher

Flutter plugin for Google libphonenumber to parse, format, and validate phone numbers.

WASM-ready
$ flutter pub add libphonenumber_plugin
Source repository

What it does

Provides utilities to format, parse, and validate phone numbers using Google's libphonenumber library. Supports Android, iOS, and Web via federated plugins.

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

Use it when

  • You need to validate phone number inputs in a cross-platform Flutter app.
  • You need to format raw phone numbers into standardized local or international formats.

Skip it when

  • You require Windows or macOS desktop support using Dart FFI (currently listed as future work).
  • You want a stable Android and iOS implementation and prefer using the original libphonenumber package instead.

Strengths

  • Supports Android, iOS, and Web platforms.
  • Provides methods to retrieve all countries and format example numbers.

Weaknesses

  • Requires manual addition of JavaScript script tags in web/index.html for Web support.
  • Documentation suggests using an alternative package for stable Android and iOS implementations.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
2

For Web usage, you must add specific script tags (libphonenumber.js and stringbuffer.js) to your web/index.html file.

import 'package:libphonenumber_plugin/libphonenumber_plugin.dart';

Future<void> checkPhoneNumber(String phoneNumber, String regionCode) async {
  bool? isValid = await Libphonenumber().isValidPhoneNumber(
    phoneNumber: phoneNumber,
    isoCode: regionCode,
  );
}

Alternatives

Packages that do the same job and could replace libphonenumber_plugin.