I have a function that picks a XLSX file from phone storage. I want to use the selected file in another function to create a list.
This is MyData:
class MyData {
MyData(this.time, this.value);
final double time;
final double value;
}
This is the function I use to select a file:
Future selectFile() async {
final result = await FilePicker.platform.pickFiles(allowMultiple: false);
if (result == null) return;
final path = result.files.single.path!;
setState(() => file = File(path));
}
Note: My xlsx file contains thousands of line so I will not share it here.