checkLatest function

dynamic checkLatest(
  1. String fileName,
  2. String downloadPath,
  3. String path
)

Implementation

checkLatest(String fileName, String downloadPath, String path) async {
  final File file =
      File(<String>{path, 'www', fileName}.join(Platform.pathSeparator));
  DateTime lastModified = await file.lastModified();

  Duration difference = DateTime.now().difference(lastModified);
  //print(difference);
  if (difference.inDays > 1) {
    await file.delete();
    await downloadFile(fileName, downloadPath, path);
  }
  return;
}