datasetSelectFile function
Implementation
Future<String> datasetSelectFile() async {
// Use the [FilePicker] to select a file asynchronously so as not to block the
// main UI thread.
FilePickerResult? result = await FilePicker.platform.pickFiles(
dialogTitle: 'Choose a csv/txt file to load as your dataset.',
type: FileType.custom,
allowedExtensions: ['csv', 'txt'],
);
String path = '';
if (result != null) {
// If a file was selected then extract the path from the selected file.
path = result.files.single.path!;
}
return path;
}