flutter_file_picker icon indicating copy to clipboard operation
flutter_file_picker copied to clipboard

Linux file picker not working in build release

Open alihassan143 opened this issue 2 years ago • 2 comments

Describe the bug file picker is working fine in debug mode but when creating snap for linux the file picker is not working

Platform

  • [ ] Android
  • [ ] iOS
  • [ ] Web
  • [x] Desktop

Platform OS version Ubuntu 22.04 LTS

How are you picking?

 Future<File> getFile(List<String> type) async {
    FilePickerResult? file = await FilePicker.platform.pickFiles(
        allowedExtensions: type,
        type: FileType.custom,
        allowMultiple: false,
        withReadStream: true);

    if (file != null) {
      return File(file.files.first.path!);
    } else {
      throw Exception("File is not seleted");
    }
  }

Details to reproduce the issue create snap for the project Error throwing in snap flutter:Exception: Couldn't find the executable zenity in the path

alihassan143 avatar Jul 28 '22 06:07 alihassan143

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Aug 05 '22 02:08 github-actions[bot]

@miguelpruivo ?

alihassan143 avatar Aug 05 '22 04:08 alihassan143

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Aug 14 '22 02:08 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Aug 28 '22 02:08 github-actions[bot]

@alihassan143 same problem, have you found a solution?

Haidar0096 avatar Sep 16 '22 10:09 Haidar0096

@Haidar0096 user file selector official flutter plugin working without any issue in any desktop also it provide more flexibility is the picking and saving files

alihassan143 avatar Sep 16 '22 10:09 alihassan143

@alihassan143

@Haidar0096 user file selector official flutter plugin working without any issue in any desktop also it provide more flexibility is the picking and saving files

Thank you I will have a look, but did you find a solution to the problem? As I already implemented my app using file_picker?

Haidar0096 avatar Sep 16 '22 10:09 Haidar0096

it works on other platforms but did not works in linux build @Haidar0096 you have to only change one function if you make and reusable picked file functions like this

     Future<File> getFile(List<String> type) async {
    final XTypeGroup typeGroup = XTypeGroup(
      extensions: type,
    );
    final XFile? file = await openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);
 
    if (file != null) {
      return File(file.path);
    } else {
      throw Exception("File is not seleted");
    }
  }`

alihassan143 avatar Sep 16 '22 11:09 alihassan143

Same problem

OdairPianta avatar Jan 12 '24 13:01 OdairPianta