whatsapp_unilink 1.0.0+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

whatsapp_unilink #

Dart package helping your app interact with WhatsApp via HTTP links (universal links). Works with Flutter.

The whatsapp_unilink package helps you build HTTP links and provides you with an idiomatic Dart interface that:

  • converts your phone number into something that WhatsApp expects ✅
  • hides the encoding and link building details from you so that you can focus on your app 🚀
  • is blazingly fast ⚡️

Continuous Integration codecov whatsapp_unilink Published by dartside.dev GitHub Stars Count

Usage #

With WhatsAppUnilink, you can create a link that will allow your users to start a chat with someone (identified with phoneNumber). By clicking the link, a chat with the person automatically opens. WhatsApp will include your message in text and it will automatically appear in the text field of a chat.

Both the phoneNumber and text arguments are optional. The phoneNumber string will be internally converted to a format that the WhatsApp API expect: any brackets, dashes, plus signs, and leading zeros or any other non-digit characters will be removed. The text is encoded using percent-encoding to make it safe for literal use as a URI component. The WhatsAppUnilink instance, whenever converted to a string, will create a WhatsApp link for you.

Flutter #

You may want to launch the WhatsApp app on your user's phone and make life easier for your users by pre-filling the mobile number and text. Use the url_launcher for launching the links you create with the whatsapp_unilink package.

import 'package:whatsapp_unilink/whatsapp_unilink.dart';
// For Flutter applications, you'll most likely want to use
// the url_launcher package.
import 'package:url_launcher/url_launcher.dart';

// ...somewhere in your Flutter app...
launchWhatsApp() async {
  final link = WhatsAppUnilink(
    phoneNumber: '+001-(555)1234567',
    text: "Hey! I'm inquiring about the apartment listing",
  // Convert the WhatsAppUnilink instance to a string.
  // Use either Dart's string interpolation or the toString() method.
  // The "launch" method is part of "url_launcher".
  await launch('$link');

Dart #

This package works everywhere and doesn't have any Flutter-specific dependency. It works on the frontend with AngularDart, or rendered to an a tag from your HTTP server.

1.0.0+1 #

Initial version 🚀


whatsapp_unilink examples #

See examples on GitHub.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  whatsapp_unilink: ^1.0.0+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:whatsapp_unilink/whatsapp_unilink.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0