system_share_method_channel.dart 903 B

1234567891011121314151617181920212223242526272829
  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/services.dart';
  3. import 'system_share_platform_interface.dart';
  4. /// An implementation of [SystemSharePlatform] that uses method channels.
  5. class MethodChannelSystemShare extends SystemSharePlatform {
  6. /// The method channel used to interact with the native platform.
  7. @visibleForTesting
  8. final methodChannel = const MethodChannel('system_share');
  9. @override
  10. Future<bool> isInstalled(String packageName) async {
  11. return await methodChannel.invokeMethod("isInstalled", {
  12. "packageName": packageName,
  13. });
  14. }
  15. @override
  16. void shareFile(String filePath, String packageName, String? shareTitle,
  17. {String? shareFileType}) {
  18. methodChannel.invokeMethod("shareFile", {
  19. "filePath": filePath,
  20. "packageName": packageName,
  21. "shareTitle": shareTitle,
  22. "shareFileType": shareFileType,
  23. });
  24. }
  25. }