flutter_file_dialog icon indicating copy to clipboard operation
flutter_file_dialog copied to clipboard

DirectoryLocation custom class

Open panalgin opened this issue 1 year ago • 1 comments

Hello,

How can we instantiniate DirectoryLocation object? Because I would like to manually set a location if the user does not select a folder to save to. In this case, I can't seem to find a constructor function for DirectoryLocation and it is not castable from "Directory" class of dart:io

DirectoryLocation? pickedDirectory =
        await FlutterFileDialog.pickDirectory();

    pickedDirectory ??=
        (await getApplicationDocumentsDirectory()) as DirectoryLocation;

The above cast does not work

panalgin avatar Apr 28 '23 14:04 panalgin

Hi @panalgin , DirectoryLocation may contain temporary permission information granted by the user with a specific directory, therefore, there is no way to constructs a DirectoryLocation without interacting with the user.

Doflatango avatar May 29 '23 13:05 Doflatango