readLinesTxt function

Future<List> readLinesTxt(
  1. String fileName, {
  2. Encoding encoding = utf8,
})

Read a TXT file and return a List where each element is line of the file fileName : file name or path of the file baseDir : optional, base directory to the file, if not informed, get current script path. encoding : optional, the encoding of the file, default is utf8 Examples

var data = await readLinesTxt('stock_data.txt');

Implementation

Future<List> readLinesTxt(String fileName, {Encoding encoding = utf8}) async {
  return await File(retrieveFilePath(fileName)).readAsLines(encoding: encoding);
}