getDirectoryPath static method

Future<String?> getDirectoryPath({
  1. String? dialogTitle,
  2. @Deprecated('Use WindowsOptions.lockParentWindow or LinuxOptions.lockParentWindow instead; this parameter will be removed in a future release.') bool lockParentWindow = false,
  3. String? initialDirectory,
  4. @Deprecated('Use androidOptions instead.') Object? androidSafOptions,
  5. AndroidOptions androidOptions = const AndroidOptions(),
  6. WindowsOptions windowsOptions = const WindowsOptions(),
  7. LinuxOptions linuxOptions = const LinuxOptions(),
  8. WebOptions webOptions = const WebOptions(),
})

Selects a directory and returns its absolute path.

The dialogTitle, if provided, will be used as the title for the directory picker dialog. The initialDirectory, if provided, will be used as the initial directory path for the directory picker.

The androidOptions, windowsOptions, linuxOptions, and webOptions parameters allow for platform-specific configurations when configuring the directory picker.

Returns a String containing the selected directory path, or null if canceled.

Implementation

static Future<String?> getDirectoryPath({
  String? dialogTitle,
  @Deprecated(
    'Use WindowsOptions.lockParentWindow or LinuxOptions.lockParentWindow instead; this parameter will be removed in a future release.',
  )
  bool lockParentWindow = false,
  String? initialDirectory,
  @Deprecated('Use androidOptions instead.') Object? androidSafOptions,
  AndroidOptions androidOptions = const AndroidOptions(),
  WindowsOptions windowsOptions = const WindowsOptions(),
  LinuxOptions linuxOptions = const LinuxOptions(),
  WebOptions webOptions = const WebOptions(),
}) {
  return FilePickerPlatform.instance.getDirectoryPath(
    dialogTitle: dialogTitle,
    initialDirectory: initialDirectory,
    androidOptions: _resolveAndroidOptions(androidSafOptions, androidOptions),
    windowsOptions: windowsOptions,
    linuxOptions: linuxOptions,
    webOptions: webOptions,
  );
}