shouldCopyFile function
Checks if source file needs to be copied based on modification time Returns true if target doesn't exist or source is newer
Implementation
Future<bool> shouldCopyFile(File source, String targetPath) async {
final targetFile = File(targetPath);
if (!await targetFile.exists()) {
return true;
}
final sourceModified = await source.lastModified();
final targetModified = await targetFile.lastModified();
return sourceModified.isAfter(targetModified);
}