W3cubDocs

/Dart 2

deleteSync method

void deleteSync ({bool recursive: false })

Synchronously deletes this FileSystemEntity.

If the FileSystemEntity is a directory, and if recursive is false, the directory must be empty. Otherwise, if recursive is true, the directory and all sub-directories and files in the directories are deleted. Links are not followed when deleting recursively. Only the link is deleted, not its target.

If recursive is true, the FileSystemEntity is deleted even if the type of the FileSystemEntity doesn't match the content of the file system. This behavior allows deleteSync to be used to unconditionally delete any file system object.

Throws an exception if the FileSystemEntity cannot be deleted.

Implementation

void deleteSync({bool recursive: false}) => _deleteSync(recursive: recursive);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-io/FileSystemEntity/deleteSync.html