size property

int get size

Get the size of the file or directory

Implementation

int get size {
  if (this is File) {
    return (this as File).lengthSync();
  }
  if (this is Directory) {
    return (this as Directory).listSync(recursive: true).fold<int>(0, (prev, element) {
      prev += element.size;
      return prev;
    });
  }

  return 0;
}