readFile static method

Future<List<String>> readFile(
  1. String fileName
)

Read the txt file inside the extracted zip file

Implementation

static Future<List<String>> readFile(String fileName) async {
  // If the whatsapp chat is shared with media, the unzipped folder will contain the media files,
  // so we need to read the txt file from the unzipped folder and list all the images and do something
  // with them
  String path = '${(await getTemporaryDirectory()).path}/unzipped/$fileName';
  File file = File(path);
  List<String> lines = await file.readAsLines();
  await _deleteDir(Directory("${(await getTemporaryDirectory()).path}/unzipped"));
  return lines;
}