system_share_method_channel.dart 937 B

123456789101112131415161718192021222324252627282930
  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. Future<void> shareFile(
  17. String filePath, String packageName, String? shareTitle,
  18. {String? shareFileType}) async {
  19. return await methodChannel.invokeMethod("shareFile", {
  20. "filePath": filePath,
  21. "packageName": packageName,
  22. "shareTitle": shareTitle,
  23. "shareFileType": shareFileType,
  24. });
  25. }
  26. }