Closed echidne closed 5 months ago
Thanks for reporting this issue.
I just released a new version (v2.1.2), in which I added a new field alwaysShowInitialDirectory
to control whether the dialog box should always show the directory defined in initialDirectory
to the user, regardless of previous user interaction.
Try this:
import 'package:filepicker_windows/filepicker_windows.dart';
void main() {
final file = OpenFilePicker()
..filterSpecification = {
'Word Document (*.doc)': '*.doc',
'Web Page (*.htm; *.html)': '*.htm;*.html',
'Text Document (*.txt)': '*.txt',
'All Files': '*.*'
}
..defaultFilterIndex = 0
..defaultExtension = 'doc'
..title = 'Select a document'
..initialDirectory = "C:\\some_path"
..alwaysShowInitialDirectory = true;
final result = file.getFile();
if (result != null) {
print(result.path);
}
}
Hi, I run the walpaper example with flutter and initialDirectory is not taken into account by the app even at fresh start after rebooting computer. My system : windows 10 pro 22H2 How to reproduce : A) run the walpaper example with "Flutter run lib/main.dart" and choosing Windows option. What I observed : at start the app is not opening in "My Pictures" folder but in the last directory I opened with a flutter app. What I did : 1) I checked that the 'picturesDirectory' variable was correct with a simple print(picturesDirectory) 2) I tried to change the value of "initialDirectory" by a correct folder path on my computer but without success. B) run the following code with dart :
=> initialDirectory is not taken into account and FilePicker propose the last directory opened.