I'm trying to use the INI Package to read a file, but when I'm trying to access the file just by reading its contents I get the following error: No such file or directory.
Here is the faulty code:
class _FactsListScreenState extends State<FactsListScreen> {
@override
Widget build(BuildContext context) {
File file = File("Assets/Facts/English.txt");
Config config = Config.fromStrings(file.readAsLinesSync());
print(config.sections());
Interesting, but when using rootBundle.loadString("Assets/Facts/English.txt")
it works, but not when using File("Assets/Facts/English.txt")
I also need to mention that I'm running the app on an Android simulator, if that makes any difference.
Yes, I have included the folder in pubspec.yaml:
Here is my file structure to show that the file is actually there:
What's the problem with the code? Why it can't find the file?