Search packages, repositories and app categories

Package detailsv2.0.2

whatsapp_share

Simple way to share message, links or files from your flutter app to specific contact in whatsapp

Android
30-day downloads
131
Likes
40
Pub points
160

Install package

flutter pub add whatsapp_share

Package Overview

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

A lightweight Flutter package that enables sharing messages, links, or files directly to a specific contact via WhatsApp on Android. It simplifies the process of opening WhatsApp with pre-filled content and a targeted contact number, enhancing user engagement through seamless communication. The package leverages Android intents for native integration, ensuring reliable delivery and minimal setup. Ideal for apps aiming to improve user outreach through direct messaging.

Use cases

  • Sharing referral links
  • Sending support messages
  • Distributing promotional content
  • Directing users to customer service
  • Automating follow-up messages
  • Sharing media files

Key features

  • Easy integration with Android intents
  • Supports text, links, and files
  • Targets specific WhatsApp contacts
  • Minimal configuration required
  • Relies on native WhatsApp functionality
  • Works offline after initial setup

Suitable for

  • Apps needing direct WhatsApp contact access
  • Customer support features
  • Marketing and referral systems
  • Content distribution tools
  • User onboarding flows

Considerations

  • Android-only platform support
  • Requires WhatsApp installed on device
  • Limited to contact-specific sharing
  • No iOS compatibility
  • Depends on system-level permissions
  • May require user confirmation for sharing

Original README

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

Whatsapp Share Plugin

pub package

A Flutter plugin for Android providing a simple way to share a message, link or local files to specific WhatsApp contact.

Features:

  • Share messages or link urls to specific contact.
  • Share local files to specific contact.

Installation

First, add this to your package's pubspec.yaml file:

dependencies:
  whatsapp_share: ^1.1.1

Now in your Dart code, you can use:

import 'package:whatsapp_share/whatsapp_share.dart';

Installation (Platform Specific)

iOS

Add if not exists one row to the ios/podfile after target runner:

...

target 'Runner' do
    use_frameworks!

...
Android

If you pretends to use the file share, you need to configure the file provider, this will give access to the files turning possible to share with other applications.

Add to AndroidManifest.xml:

<application>
...
<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="${applicationId}.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths"/>
</provider>
</application>

Obs: You can change the android:name if you have an extension of file provider.

Add res/xml/provider_paths.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="external_files" path="."/>
</paths>

If you want to learn more about file provider you can access:

  • https://developer.android.com/reference/android/support/v4/content/FileProvider

How to use?

Here is an snippets app displaying the two whatsapp share methods .

Whatsapp installed in this device ?
 Future<void> isInstalled() async {
    final val = await WhatsappShare.isInstalled(
      package: Package.businessWhatsapp
    );
    print('Whatsapp Business is installed: $val');
  }

If whatsapp is not installed, please do not call WhatsappShare.share() and WhatsappShare.shareFile()

Share text, links

 Future<void> share() async {
    await WhatsappShare.share(
      text: 'Whatsapp share text',
      linkUrl: 'https://flutter.dev/',
      phone: '911234567890',
    );
  }

Share images, files

_image1.path contains path of the file which is shared to the whatsapp.


 Future<void> shareFile() async {
    await WhatsappShare.shareFile(
      phone: '911234567890',
      filePath: [_image1.path, _image2.path],
    );
  }

Categories

Source repository

Projects using this package

No data available yet.