openSystemShare function

Future<String?> openSystemShare({
  1. String title = 'Share',
  2. String? content,
  3. List<String>? imagesPath,
  4. required ShareType shareType,
})

系统分享

Implementation

Future<String?> openSystemShare(
    {String title = 'Share',
    String? content,
    List<String>? imagesPath,
    required ShareType shareType}) async {
  if (!supportPlatformMobile) return 'not support Platform';
  if (shareType == ShareType.images) {
    if (imagesPath == null || imagesPath.isEmpty)
      return 'The shareType cannot be empty';
  }
  if (content == null && imagesPath == null)
    return 'A share parameter must be passed content or imagesPath';
  if (content != null && imagesPath != null)
    return 'Only one parameter can be passed';
  return await curiosityChannel
      .invokeMethod('openSystemShare', <String, dynamic>{
    'title': title,
    'content': content,
    'type': shareType.toString().split('.')[1],
    'imagesPath': imagesPath
  });
}