I have trouble loading a html file stored in my assets folder. I've been searching for 2 days and I can't seem to find out why.
I've made sure to include it in pubspec.yaml as well, with the proper indentations and all - builds fine. The image assets I loaded in pubspec.yaml loads no problem so I know everything should be okay with that part.
I've also tried to test it with a .txt file following the exact sample code here: https://api.flutter.dev/flutter/dart-io/File-class.html - from "Reading from a file" as a stream section. It gives the same error.
This is what I'm trying to do:
// Tried this with a test .txt file too ('assets/html/test.txt')
File file = new File('assets/html/emaiL_bank.html');
Stream<List<int>> inputStream = file.openRead();
inputStream
.transform(utf8.decoder)
.transform(new LineSplitter())
.forEach((l) => print('testing Print: $l'));
This is a section of my pubspec.yaml:
flutter:
assets:
- assets/images/ic_splashscreen.jpg
- assets/images/at.png
- assets/images/lock.png
- assets/html/emaiL.html
- assets/html/emaiL_bank.html
- assets/html/test.txt
..and I get OS Error: No such file or directory, errno = 2 when it's trying to do file.openRead()
Tried flutter clean, restarting IDE, rebuild - nothing seems to have any effect.
Any help/clue would be much appreciated.