[docs,io] Clarify that isDirectory is not meaningful for FileSystemDeleteEvent.

Bug: https://github.com/dart-lang/sdk/issues/55130
Change-Id: I43c95218cd9f6b87ab242affa8cc2b9d42df7d96
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357663
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
This commit is contained in:
Brian Quinlan 2024-03-30 01:03:08 +00:00 committed by Commit Queue
parent 50360c51ce
commit 9b2b0ac848
2 changed files with 17 additions and 7 deletions

View file

@ -41,6 +41,9 @@ advantage of these improvements, set your package's
`stderr`. Classes that `implement Stdout` must define the `lineTerminator`
field. The default semantics of `stdout` and `stderr` are not changed.
- Deprecates `FileSystemDeleteEvent.isDirectory`, which always returns
`false`.
[#53863]: https://github.com/dart-lang/sdk/issues/53863
#### `dart:js_interop`

View file

@ -897,11 +897,13 @@ sealed class FileSystemEvent {
/// relative.
final String path;
/// Is `true` if the event target was a directory.
/// Whether the event target is a directory.
///
/// Note that if the file has been deleted by the time the event has arrived,
/// this will always be `false` on Windows. In particular, it will always be
/// `false` for `delete` events.
/// The value will always be `false` for [FileSystemDeleteEvent].
///
/// On Windows, the value may also be `false` for a create, move or
/// modify event on a directory, if that directory was deleted
/// soon after this create, modify or move event occured.
final bool isDirectory;
FileSystemEvent._(this.type, this.path, this.isDirectory);
@ -936,10 +938,15 @@ final class FileSystemModifyEvent extends FileSystemEvent {
final class FileSystemDeleteEvent extends FileSystemEvent {
/// Constructs a new [FileSystemDeleteEvent].
FileSystemDeleteEvent(String path, bool isDirectory)
: super._(FileSystemEvent.delete, path, isDirectory);
: super._(FileSystemEvent.delete, path, false);
String toString() =>
"FileSystemDeleteEvent('$path', isDirectory=$isDirectory)";
String toString() => "FileSystemDeleteEvent('$path')";
/// Whether the file system object was a directory.
///
/// The value will always be `false` for [FileSystemDeleteEvent].
@Deprecated('always false for FileSystemDeleteEvent')
bool get isDirectory => false;
}
/// File system event for moving of file system objects.