i am new to dart I would like to find out how to write a code in dart for An instance of a class that is initialized with data from a file
void main() async {
final file = File('OOPmovie_metadata.csv');
Stream<String> lines =
file.openRead().transform(utf8.decoder).transform(LineSplitter());
try {
await for (var line in lines) {
print('$line : ${line.length} characters');
}
print('file is closed');
} catch (e) {
print('error : $e');
}
}
this what i tried and i keep getting this error : PathNotFoundException: Cannot open file, path = ‘OOPmovie_metadata.csv’ (OS Error: The system cannot find the file specified.
, errno = 2)“
New contributor
Xhulu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.