Skip to content

FilePicker.platform.saveFile(...) doesn't save a file on Linux, but does on Android (emulator) #1907

@aiurovet

Description

@aiurovet

I'm developing a Flutter application that saves images to external storage as one of its activities. When I use an Android emulator, FilePicker.platform.saveFile allows selecting a folder and a filename, then saves data (parameter bytes) there. But when I run the Linux app (my dev machine is running Kubuntu 25.04), I select a folder and a filename, no exception is thrown, everything looks good, but the file is not there (or not overwritten if it existed before). When googling a solution, the AI-generated result mentioned that I have to save the file myself: await File(path).writeAsBytes(bytes);

So, at the moment, I'm passing Uint8List(0) as bytes to FilePicker.platform.saveFile(...), then saving as above.

But why is it asymmetric? And what's the point of requiring a non-null array of bytes if it is not always used?

Package version: 10.3.3 (at the moment, the latest).

Platform: Desktop (Linux)

Platform OS version: Kubuntu 25.04

How are you picking?

      var outFilePath = await FilePicker.platform.saveFile(
        dialogTitle: 'Save Image As',
        type: FileType.image,
        allowedExtensions: ['png',],
        fileName: 'test.png',
        bytes: bytes, // obtained before
      );

Details to reproduce the issue: just confirm it works under every target platform the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new issueAn issue that hasn't yet been seen from the maintainerstale

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions