miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.27k stars 618 forks source link

`saveFile` with `initialDirectory` fails silently #1512

Closed noxasch closed 1 month ago

noxasch commented 1 month ago

Describe the bug When saveFile with initialDirectory fails silently and return null. No save as is shown. But if I remove the initialDirectory, it running as expected.

Platform

Platform OS version MacOS 13.5.2

How are you picking?

    final appDocuments = (await getApplicationDocumentsDirectory());
    final destinationPath =
        path.join(appDocuments.path, 'test');
    print('DEBUG: $destinationPath');
    String? result = await FilePicker.platform.saveFile(
      initialDirectory: destinationPath,
      dialogTitle: 'Save as',
      fileName: 'test.txt',
      type: FileType.custom,
      allowedExtensions: ['txt'],
    );
    print('RESULT: $result'); // output RESULT: null

Details to reproduce the issue Provide all the details to reproduce the issue.

Error Log No error

Flutter Version details Please, post the output of your flutter doctor -v, preferably, while running the issued device/simulator.

[✓] Flutter (Channel stable, 3.19.6, on macOS 13.5.2 22G91 darwin-x64, locale en-MY)
    • Flutter version 3.19.6 on channel stable at /Users/dischberg/fvm/versions/3.19.6
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (4 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[!] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.5.2 22G91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.60

[✓] Network resources
    • All expected network resources are available.

Additional context Using either sandboxed or unsanboxed path and even full path with /Volumes/Macintosh HD/Users still the same result

noxasch commented 1 month ago

closing this as not a bug. on my side need to make sure the path / dir exist.