setLastModifed function

void setLastModifed(
  1. String path,
  2. DateTime lastModified
)

Sets the last modified datetime on the given the path.

path can be either a file or a directory.

Throws a DCliException with a nested FileSystemException if the file does not exist or the operation fails.

Implementation

void setLastModifed(String path, DateTime lastModified) {
  try {
    File(path).setLastModifiedSync(lastModified);
  } on FileSystemException catch (e) {
    throw DCliException.from(e, Trace.current());
  }
}