getDirectoryPath method

  1. @override
Future<String?> getDirectoryPath(
  1. String dialogTitle,
  2. bool lockParentWindow,
  3. String initialDirectory
)
override

Implementation

@override
Future<String?> getDirectoryPath(String dialogTitle, bool lockParentWindow, String initialDirectory) async {
  try {
    return await methodChannel.invokeMethod('dir', {});
  } on PlatformException catch (ex) {
    if (ex.code == "unknown_path") {
      debugPrint(
          '[$_tag] Could not resolve directory path. Maybe it\'s a protected one or unsupported (such as Downloads folder). If you are on Android, make sure that you are on SDK 21 or above.');
    }
  }
  return null;
}