openChat method

Future<void> openChat({
  1. required String phone,
  2. required String text,
})

Opens a WhatsApp chat with phone using the Click-to-Chat URL (https://wa.me/{phone}?text={text}).

Unlike shareToChat, this method works for any phone number regardless of whether the user has previously chatted with that number. However, it only supports text — images cannot be attached.

Throws a PlatformException when no app can handle the URL.

Implementation

Future<void> openChat({required String phone, required String text}) {
  throw UnimplementedError('openChat() has not been implemented.');
}