system_share_method_channel.dart 834 B

123456789101112131415161718192021222324252627
  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. methodChannel.invokeMethod("shareFile", {
  18. "filePath": filePath,
  19. "packageName": packageName,
  20. "shareTitle": shareTitle,
  21. });
  22. }
  23. }