statSync method

FileStat statSync(String path)

Calls the operating system's stat() function on path. Returns a FileStat object containing the data returned by stat(). If the call fails, returns a FileStat object with .type set to FileSystemEntityType.NOT_FOUND and the other fields invalid.

Source

static FileStat statSync(String path) {
  // Trailing path is not supported on Windows.
  if (Platform.isWindows) {
    path = FileSystemEntity._trimTrailingPathSeparators(path);
  }
  var data = _statSync(path);
  if (data is OSError) return FileStat._notFound;
  return new FileStat._internal(
      new DateTime.fromMillisecondsSinceEpoch(data[_CHANGED_TIME]),
      new DateTime.fromMillisecondsSinceEpoch(data[_MODIFIED_TIME]),
      new DateTime.fromMillisecondsSinceEpoch(data[_ACCESSED_TIME]),
      FileSystemEntityType._lookup(data[_TYPE]),
      data[_MODE],
      data[_SIZE]);
}

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