readSaveChannel method

Future<List<String>> readSaveChannel()

Implementation

Future<List<String>> readSaveChannel() async {
  List<String> result = [];
  String dirPath = _savePath + "/" + CACHE_DIR_NAME;
  Directory dataDir = Directory(dirPath);
  if (!dataDir.existsSync()) {
    return result;
  }
  dataDir
      .listSync()
      .where((element) {
        return element.path.split("/").last.contains(SHOULD_UPLOAD_KEY) &&
            element is File;
      })
      .map((e) => e as File)
      .forEach((file) async {
        result.addAll(file.readAsLinesSync());
      });
  return result;
}