shareToWhatsApp method

Future<String?> shareToWhatsApp({
  1. String msg = '',
  2. String imagePath = '',
})

share to WhatsApp imagePath is local image

Implementation

Future<String?> shareToWhatsApp({String msg = '', String imagePath = ''}) async {
  final Map<String, dynamic> arguments = Map<String, dynamic>();
  arguments.putIfAbsent('msg', () => msg);
  arguments.putIfAbsent('url', () => imagePath);
  dynamic result;
  try {
    result = await _channel.invokeMethod('shareWhatsApp', arguments);
  } catch (e) {
    return "false";
  }

  return result;
}