WhatsappDirectSend class

A Flutter plugin to send text messages and/or images directly to a WhatsApp contact on Android.

Uses Intent.ACTION_SEND under the hood and automatically picks WhatsApp or WhatsApp Business if installed, falling back to the system share sheet otherwise.

Usage

// Share text + image to a known contact
await WhatsappDirectSend.shareToChat(
  phone: '1234567890',
  text: 'Check this out',
  filePath: '/data/user/0/com.example/cache/report.png',
);

// Open chat with any number (text only)
await WhatsappDirectSend.openChat(
  phone: '1234567890',
  text: 'Hello from Flutter!',
);

Constructors

WhatsappDirectSend()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

openChat({required String phone, required String text}) Future<void>
Opens a WhatsApp chat with phone and pre-fills the message with text using WhatsApp's Click-to-Chat URL (https://wa.me/{phone}?text={text}).
shareToChat({required String phone, required String text, String? filePath}) Future<void>
Shares content to a WhatsApp chat with phone using ACTION_SEND.