system_share_util.dart 733 B

12345678910111213141516171819202122232425262728
  1. import 'dart:io';
  2. import 'package:system_share/system_share.dart';
  3. class SystemShareUtil {
  4. SystemShareUtil._();
  5. static const wechatPageName = 'com.tencent.mm';
  6. static const qqPageName = 'com.tencent.mobileqq';
  7. static Future<void> shareSystemFile(String packageName, String filePath,
  8. {String? shareTitle, String? shareFileType}) async {
  9. if (Platform.isAndroid) {
  10. return SystemShare.shareFile(filePath, packageName, shareTitle,
  11. shareFileType: shareFileType);
  12. }
  13. }
  14. static Future<bool> isInstalled(String packageName) {
  15. return SystemShare.isInstalled(packageName);
  16. }
  17. }
  18. class SystemShareException implements Exception {
  19. final String message;
  20. SystemShareException(this.message);
  21. }