I am new to flutter and a have question that shouldn\'t be to hard to answer for a pro.
I have a simple spreadsheet with 5 columns and 10 rows. Now I have two variab
Thanks for your answers. I made it work using async
and await
as can be seen in the following. Important as well is to declare the asset file in your pubspec.yaml
like
flutter:
assets:
- assets/res/Book1.csv
Then declare both functions and just call loadCSV()
when you want to load the data.
Future<String> loadAsset(String path) async {
return await rootBundle.loadString(path);
}
void loadCSV() {
loadAsset('assets/res/Book1.csv').then((dynamic output) {
csvRaw = output;
});
}