readLTsv function

Future<Table> readLTsv(
  1. Blob file, {
  2. Encoding encoding = utf8,
})

Reads file/blob as labeled TSV file

Implementation

Future<Table> readLTsv(Blob file, {Encoding encoding = utf8}) async {
  final reader = FileReader();
  reader.readAsText(file);
  await reader.onLoadEnd.first;
  if (reader.readyState != FileReader.DONE) {
    throw Exception('Loading File/Blob failed!');
  }
  if (reader.result is! String) {
    throw Exception('Could not read File/Blob!');
  }
  return parseLTsv(reader.result as String);
}