Closed
Description
Similar to #52027 and #51912, could FileSystemEntity
also be sealed so that functions like:
Z matchFileSystemEntity<Z>({
required final FileSystemEntity entity,
required final Z Function(Directory) directory,
required final Z Function(File) file,
required final Z Function(Link) link,
}) {
if (entity is Directory) {
return directory(entity);
} else if (entity is File) {
return file(entity);
} else if (entity is Link) {
return link(entity);
} else {
throw Exception(
"Invalid state. " + entity.toString() + " was expected to be a directory, file or link.",
);
}
}
can be replaced with exhaustive switches?