Directory picker in Flutter con file_picker
file_picker è una libreria per Flutter che ci consente di scegliere un o più files, o anche una directory.
Che è il caso che vedremo noi.
In sostanza si aprirà il classico dialog, nativo, per scegliere file/directory.
Per l'installazione:
flutter pub add file_picker
Qui sotto un esempio:
ElevatedButton(
onPressed: () async {
String? selectedDirectory =
await FilePicker.platform.getDirectoryPath();
if (selectedDirectory != null) {
print(selectedDirectory);
}
},
child: Text('Premi'),
),
Enjoy!
dart flutter file_picker
Commentami!