shareFile method

  1. @override
Future<void> shareFile({
  1. required String path,
  2. required String packageName,
  3. String title = "分享",
  4. void whenNotFoundApp()?,
})
override

Implementation

@override
Future<void> shareFile({
  required String path,
  required String packageName,
  String title = "分享",
  void Function()? whenNotFoundApp,
}) async {
  try {
    await methodChannel.invokeMethod('shareFile', {
      'path': path,
      'packageName': packageName,
      'title': title,
    });
  } on PlatformException catch (e) {
    if (e.code == 'UNAVAILABLE') whenNotFoundApp?.call();
  }
}