share method

Future<bool> share({
  1. WhatsApp type = WhatsApp.standard,
  2. String? phone,
  3. String? text,
  4. XFile? file,
})

Share text message and or file into whatsapp

phone is optional for Android, mandatory for Web, MacOS, Linux and Windows. But it will be ignored on iOS.

You need to either set text and or phone.

Implementation

Future<bool> share({
  WhatsApp type = WhatsApp.standard,
  String? phone,
  String? text,
  XFile? file,
}) {
  assert(!(text == null && file == null), "Either set text and or file");

  return ShareWhatsappPlatform.instance
      .share(type: type, phone: phone, text: text, file: file);
}