@@ -176,10 +176,18 @@ class FileManager {
176176 static Directory getRootDirectory () => Directory (documentsDirectory);
177177
178178 /// Writes [toWrite] to [filePath] .
179- static Future <void > writeFile (String filePath, List <int > toWrite,
180- {bool awaitWrite = false , bool alsoUpload = true , DateTime ? lastModified}) async {
181- // if lastModified is used, then last modified time stamp is set after file write
182- // it is used when downloading remote file, to set the same time stamp as has the file
179+ ///
180+ /// The file at [toPath] will have its last modified timestamp set to
181+ /// [lastModified] , if specified.
182+ /// This is useful when downloading remote files, to make sure that the
183+ /// timestamp is the same locally and remotely.
184+ static Future <void > writeFile (
185+ String filePath,
186+ List <int > toWrite, {
187+ bool awaitWrite = false ,
188+ bool alsoUpload = true ,
189+ DateTime ? lastModified,
190+ }) async {
183191 filePath = _sanitisePath (filePath);
184192 log.fine ('Writing to $filePath ' );
185193
@@ -201,9 +209,7 @@ class FileManager {
201209 ]);
202210
203211 void afterWrite () {
204- if (lastModified != null ){
205- // want to set timestamp of last modification. Used when downloading remote file, to put the same time stamp
206- // to avoid synchronization of newly created file back to remote.
212+ if (lastModified != null ) {
207213 file.setLastModified (lastModified);
208214 }
209215 broadcastFileWrite (FileOperationType .write, filePath);
0 commit comments