deleteAllExternalFiles static method

Future deleteAllExternalFiles()

Deletes all the files of the documents that have been imported from outside the local file system (e.g. using fromURL).

Implementation

static Future deleteAllExternalFiles() async {
  try {
    String tempDirPath = (await getTemporaryDirectory()).path;
    Directory dir = Directory(join(tempDirPath, _TEMP_DIR_NAME));

    if (dir.existsSync()) {
      dir.deleteSync(recursive: true);
    }
  } catch (e) {
    return Future.error(e);
  }
}