whatsApp method

Future<bool> whatsApp({
  1. required String text,
})

Opens WhatsApp with text (whatsapp://send?text=); if WhatsApp can't be opened, presents the system share sheet. Returns true when WhatsApp itself was opened (the plugin's native side; no canOpenURL check, so no Info.plist entry is required).

Implementation

Future<bool> whatsApp({required String text}) async {
  var opened = false;
  try {
    opened = await _openUrl(whatsAppUri(text));
  } catch (_) {
    opened = false;
  }
  if (opened) return true;
  await system(text: text);
  return false;
}