asDirectory function

Directory asDirectory(
  1. FileSystemEntity dir
)

convert to a directory object if necessary

Implementation

Directory asDirectory(FileSystemEntity dir) {
  if (dir is Directory) {
    return dir;
  } else {
    return Directory(dir.path);
  }
}