Issue
For example, place the test.csv file directly under the lib directory of the flutter project.
If I want to get the CSV(string) in that file and do something with it when running the app, how do I get(retrieve) the CSV file?
Solution
Generally external files are placed in an assets folder. Assuming you put it in the root of the assets folder. You need to do two manipulations.
List this file as an asset in the pubspec.
assets:
- assets/my_csv_file.csv
2.Read it in your app.
import "package:flutter/services.dart" as s;
var csvData = await s.rootBundle.loadString("assets/my_csv_file.csv");
Edit : the assets folder is in the root of the project.
Answered By - Bienvenu Agbavon
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.