share method

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

Implementation

@override
Future<bool> share({
  WhatsApp type = WhatsApp.standard,
  String? phone,
  String? text,
  XFile? file,
}) async {
  assert(phone != null, 'Phone parameter is required');
  assert(text != null, 'Text parameter is required');

  final url = Uri.https(
    'wa.me',
    phone!.removeNonNumber(),
    <String, String>{'text': text!},
  );

  if (await canLaunchUrl(url)) {
    return await launchUrl(url);
  }

  return false;
}