openDownloadFolder method

  1. @override
Future<bool> openDownloadFolder()
override

Implementation

@override
Future<bool> openDownloadFolder() async {
  if (Platform.isAndroid || Platform.isIOS) {
    // Open the download folder directly on Android and iOS using the platform-specific channel.
    final result =
        await methodChannel.invokeMethod<bool?>('openDownloadFolder');
    return result ?? false;
  }

  // For other platforms, retrieve the download folder path and attempt to launch the file explorer or file manager.
  final downloadPath = await getDownloadFolderPath();
  return launchUrl(Uri.parse(downloadPath ?? ''));
}